Sharing my React component on Github?

Hi all, I’m trying to share one of my React components through Github. This is a first for me and it looks like I did it wrong. Here’s what I did, and what’s wrong:

  1. created a component Foo via npx create-react-app
  2. tested and built the component via npm run build
  3. pushed everything to a new git repo
  4. back in my other app Bar that I want to use Foo in, I did an npm install --save
  5. then in Bar I did import Foo from "Foo/src/Foo";

This is where the error happens, and it makes sense. When I try to build Bar I get an error:

Foo/src/Foo.js: Support for the experimental syntax 'jsx' isn't currently enabled

It makes sense because Foo.js is just the raw source code, not the built project. So I need to somehow:

  1. publish the built project to git
  2. make sure that I don’t accidentally include React twice, since both Foo and Bar are using it

I googled around but mostly found tutorials on Github Pages, which isn’t what I want. I want to just host this component (and more in the future) so I can easily pull them in to other apps of my own creation.

I’m sure there’s something simple I’m missing?

If anyone ever sees this, nwb is what worked for me: GitHub - insin/nwb: A toolkit for React, Preact, Inferno & vanilla JS apps, React libraries and other npm modules for the web, with no configuration (until you need it)