VALIS-software / valis-hpgv

High performance WebGL genome visualization
http://www.valis.bio
MIT License
14 stars 5 forks source link

Remove React dependency #1

Open haxiomic opened 5 years ago

haxiomic commented 5 years ago

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

hitz commented 5 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?

haxiomic commented 5 years ago

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