-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using with React #20
Comments
I just created an example for you: https://replit.com/@Drarig29/React-and-brackets-viewerjs Basically, there is no React component created in this library because all the rendering is done manually with a defined CSS file and a JS file which adds So, just add this in your <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Drarig29/brackets-viewer.js/dist/brackets-viewer.min.css" />
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/Drarig29/brackets-viewer.js/dist/brackets-viewer.min.js"></script> Or you could install the package using npm or yarn and serve these files from your Once you've done that, you can make your React component to wrap the viewer. For example: import React, { useEffect } from 'react';
const URL = 'https://raw.githubusercontent.com/Drarig29/brackets-viewer.js/master/demo/db.json';
async function render() {
const data = await fetch(URL).then(res => res.json());
window.bracketsViewer.render({
stages: data.stage,
matches: data.match,
matchGames: data.match_game,
participants: data.participant,
});
}
function App() {
useEffect(() => {
render();
}, []);
return <div className="brackets-viewer"></div>
}
export default App; Obviously, you would host your own database and fetch this one (not my static demo |
@nakullondhe closing this as you don't answer. |
It would be really helpful if we have details about using on react or other libraries
The text was updated successfully, but these errors were encountered: