Skip to content
An example setup for universal components
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Universal Components Example

An example setup for building/testing/deploying universal components with React

Folder Structure

This project uses Lerna to make managing multiple NPM packages easier. Often times you will end up with other packages related to your universal components package and using Lerna makes managing the inter-dependencies easier.

  • packages: This directory holds the actual NPM packages you want to publish via Lerna (currently only the universal-components package.
  • examples: This directory holds a web and a native example app.

Available Scripts

lerna bootstrap

Hoists shared dependencies from any packges in packages directory. Also creates symlinks for inter-dependent packages in packages directory

lerna publish

Publishes new tags and package versions for any packages in packages directory that have changed since last publish

Running the Examples


This app was created using create-react-app. And although CRA supports using react-native-web out of the box, we need to eject so that we can update Webpack config to also parse the universal components package (we must also do the same in prod Wepback config).

You can see the universal component being included here.

cd examples/web
yarn install
yarn start


This app was created using create-react-native-app. There were no special setup steps required.

You can see the universal component being included here.

cd examples/native
yarn install
yarn start
You can’t perform that action at this time.