Open haxiomic opened 6 years ago
I was just about to make a ticket about embedding genome browser in a react project. I was just looking for a how-to but maybe you have to remove the dependency first?
Hey @hitz, you can use it in a react project by calling reactRender(props: {width, height})
which produces a react element. For example, to use it with JSX you can do something like:
constructor() {
this.hpgv = new GenomeVisualizer(configuration);
}
render() {
return (
<div>
{this.hpgv.reactRender({ width: this.state.viewerWidth, height: this.state.viewerHeight})}
</div>
);
}
There's two builds of hpgv in dist/, one with the react dependency embedded and the other without
If you've already got react included in your project, then use the valis-hpgv.react-peer.js
build
Currently React is required to use the browser, however it's only needed for the headers which could be done via plain-old html
It would be nice to remove the React dependency to simplify the experience for users
This also requires removing the material-ui dependency