# OP JavaScript Library for React
This library is to be used with `create-react-app`.

## Install library to project via npm

You will first need to create an npm account, which can be done at the offical npm website: [https://www.npmjs.com/](https://www.npmjs.com/). If you haven't already been added to the OpenPharma npm team after account creation, please contact administrator for more details to be added. 

```sh
# login to npm account
npm login
# you will asked for your npm username, password and a public email
# after login you can install the private library
npm i --save @openpharma/op-js-lib-react

# to view the library op-js-lib-react components & proporties
cd npm i
cd ./node_modules
cd @openpharma/op-js-lib-react
npm start
```

## Install via npm link
```sh
# link this lib (if you have a permissions error, try 'sudo npm ...')
npm i
npm link

# cd into your create-react-app created project
# add material ui dependencies
cd 'your-react-app-folder'
npm i --save @material-ui/core
npm i --save @material-ui/icons

# add the linked library
npm link op-js-lib-react

# start the app
npm start

# to view the library op-js-lib-react
cd ..
cd op-js-lib-react
npm start
```

## Documentation
To run the docs just do `npm start`

Available here: [http://localhost:6060](http://localhost:6060)

## Development
You can develop on the React library while simultaneously testing a dependency React app.

Run `npm start` to view the changes in the Documentation app.

To view changes in your dependency app have `npm run watch` running.
