DEV Community

Krishnan S
Krishnan S

Posted on


How can we test useState hooks inside a void function with jest and enzyme?

I'm new to unit-testing and writing test cases using jest and enzyme in React. Can someone please help me to write the test case for this example?

const [open, setOpen] = useState(false);
const handleClose = () => {

//this handleClose is an onClick event
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git