Publishing a React component as an NPM package is a great way to share your code with the wider community. It’s possible to publish packages as public as well as private packages on the NPM registry. The create-react-library command initializes your project to be published along with an example app.