React tools
This repository contains general-purpose functions for use with React and React DOM.
The library assumes that react
and react-dom
are available at runtime.
The module is intended to be used with Rollup as a packaging tool, and no particular effort is made to scope the content by subject matter (beyond the dependency on React).
The library is written in TypeScript and includes type definitions.
For additional notes, see the mindgrub
package.
Assumptions
This library is 99% environment agnostic. However, it is compiled with the
dom
lib because of one reference to window.requestAnimationFrame
in
withAsync.tsx
. In that particular case, the same effect could probably be
achieved by changing it to global.setImmediate
, which does not assume a
browser environment.
However, more consideration would be required before these functions could be deemed “isomorphic,” i.e. supporting server-side render. So for the moment this l ibrary makes a de facto assumption that it is used in a browser.
Code formatting
This codebase uses prettier as a formatter, and includes
a Gitlab CI step to verify this on commits. If you use editor integration
to get format-on-save (recommended), then no additional steps are necessary.
But you can also run npm format
before committing to validate.