Great you're using React! We're also (happy and heavy) users of React. In fact (as you noticed), the API of the library was inspired by React, i.e.
WolframNotebookEmbedder.embed(url, container);
is intentionally similar to
ReactDOM.render(component, container);
While the embedder library doesn't expose a React component (yet; or maybe it will be another little library that does that at some point), it's definitely meant to allow usage in conjunction with React, and it should be straight-forward to do so. You'd create a wrapper component that renders a single <div>
which the notebook can be embedded into, much like described here: https://reactjs.org/docs/integrating-with-other-libraries.html#how-to-approach-the-problem (just call this.embedding = WolframNotebookEmbedder.embed(url, this.el)
in componentDidMount
and this.embedding.then(nb => nb.detach())
in componentWillUnmount
, instead of the jQuery calls in the example there).
In terms of installing the library, using npm (or Yarn) is the right way to go if you have a build/bundle process anyway (which you do, if you're using Create React App). I would only use script tag/CDN-based approach if I didn't have such a process (e.g. in light-weight examples).
I'm not sure why npm install
didn't work for you. Attaching the logs would be useful. I just tried in a fresh CRA project, and
npm install --save wolfram-notebook-embedder
works fine for me.