traversal-react-redux v0.1.21
React components and redux tools for use with the Traversal Engine API
Installation
DoctorLink's Traversal Client Tools are available as an npm package.
npm install @doctorlink/traversal-react-redux
Contents
Section | Description |
---|---|
Components | All of the components used in the library |
Component Modules | Components combined in useful ways |
Theming | Creating custom themes |
Redux Reducers | Defining/updating the store |
Actions | Actions to be dispatched to the store |
Containers | Components bound to state/actions |
Sagas | Sagas to handle state side-effects |
Services | Services for making api calls |
Store | Complete Redux-Saga Stores |
Samples | Samples of how this library can be used |
Usage
Here is a quick example to get you started, it's all you need:
import React from 'react';
import { render } from 'react-dom';
import { TraversalStore, TraversalApp } from '@doctorlink/traversal-react-redux';
//Token requested from POST https://prod-platform-identity.doctorlink.engineering/connect/token
const bearerToken = 'TOKEN';
const productId = 1;
const traversalEngineApi = 'https://prod-platform-traversal-engine.doctorlink.engineering';
const traversalStore = new TraversalStore(traversalEngineApi);
traversalStore.store.dispatch(traversalStart({productId}));
traversalStore.setToken(bearerToken)
render(<TraversalApp store={traversalStore.store} />, document.getElementById('root'));
Development
For ease of development, use npm link
to point your client app to this library. You can then run npm start
to compile your code on save, and your changes should be picked up immediately by your client app. For example:
cd TraversalReactRedux
npm link
cd ../TraversalEngineAPI/services/traversalclient/ClientApp/
npm link @doctorlink/traversal-react-redux
# In another console:
cd TraversalReactRedux
npm start
If you get an error about duplicate versions of react and/or react-dom ("Hooks can only be called inside the body of a function component"), try pointing this library to the versions used by your app:
npm link ../TraversalEngineAPI/services/traversalclient/ClientApp/node_modules/react
npm link ../TraversalEngineAPI/services/traversalclient/ClientApp/node_modules/react-dom
Note that react and react-dom are required both as peerDependencies
and devDependencies
; the latter is because they are required by the unit tests.
Publish
To publish the library run the AZDO publish pipeline. By default this will publish a patch release and update the latest tag in npm, but both of these options can be overriden in the variables tab.
Version can be one of the following: patch | minor | major | prepatch | preminor | premajor | prerelease
Tag can be overriden for other streams: latest | beta | next | staging
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago