A minimal setup to develop and publish a React Component.
- Clone this repo:
git clone git@github.com:mllocs/react-component-example.git
-
Edit the
package.json
(update the component name, author, ...). -
Install the npm packages, link the library and run the build watch if you want to work on the component while testing it from another project:
npm install
npm link
npm run build:watch
- Use the component from another project. From the root of the other project run:
npm link react-component-example # Update accordingly
and use it as you would use any other component:
import Example from 'react-component-example'; // Update accordingly