npm.io
0.1.8 • Published 7 years ago

@react-mock/state

Licence
MIT
Version
0.1.8
Deps
2
Size
7 kB
Vulns
0
Weekly
0
Stars
365

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.