USPS shared React components library
npm install @unitedstatespowersquadrons/components!NPM Version

``ts`
import * from "@unitedstatespowersquadrons/components";
Install dependencies with
`sh`
yarn
Components can be mounted by passing them into the included mount function in
your application asset root.
`tsx`
mount({
ActionButton,
});
This will search the DOM for elements matching the following pattern, and
attempt to render the corresponding component at that location.
`html`
In Rails, you can generate this element with the following helper call:
`rb`
content_tag(:div, '', data: { 'react-component' => component_name, props: props.to_json })
More detailed information is available for Toasts usage.
To create a reducer, follow the pattern described in Reducer/Example.
There is also an example in appstate.tsx for if you only need access to app
state, but do not have any dispatchable events.
To include the TSC config from this library, create ./tsconfig.json:
`json`
{
"extends": "./node_modules/@unitedstatespowersquadrons/components/tsconfig.json",
"exclude": [
"**/proto",
"node_modules",
"public",
"vendor",
"tmp"
]
}
GitHub Actions will automatically run eslint and tsc` on branch pushes.