DEV Community

Discussion on: Testing React Hook State Changes

Collapse
 
victor95pc profile image
Victor Palomo de Castro

If you guys wants a way that gives you full access to your react hooks's states and dispatchers without the pain to extract or modify your code.

You can use my library: github.com/victor95pc/jest-react-h...

Collapse
 
juuuuuuuuuuuuuu profile image
juuuuuuuuuuuuuu

how to get init state not using library ?

Collapse
 
timurcatakli profile image
Timur Catakli

I am getting following error after npm install.

SyntaxError: Unexpected identifier

      1 | import React from 'react';
    > 2 | import setupMockStates from 'jest-react-hooks-mock';
        | ^
      3 | import { shallow } from 'enzyme';