@react-mock/state
TypeScript icon, indicating that this package has built-in type declarations

0.1.8 • Public • Published

Component state

Inject React component state declaratively.

StateMock must be the direct parent of the stateful component for the state injection to work.

import { StateMock } from '@react-mock/state';

render(
  <StateMock state={{ count: 5 }}>
    <Counter />
  </StateMock>
);

Warning: StateMock delays ref calls. This means refs can get called after componentDidMount, instead of before as you might expect.

Readme

Keywords

none

Package Sidebar

Install

npm i @react-mock/state

Weekly Downloads

2,194

Version

0.1.8

License

MIT

Unpacked Size

7.4 kB

Total Files

6

Last publish

Collaborators

  • skidding