Setup Codesandbox.io + Jest to work with React Components for testing.

First step is create a new sandbox with the create-react-app base. Then add these three dependencies to your sandbox.

enzyme & enzyme-adapter-react-16 & @testing-library/react

The enzyme-adapter-react-16 name will slightly change with newer releases of react.

Next, create a file in your src folder and name it setupTests.js . This files goves jest with the ability to understand React.

Also, insert this in to your package.json file.

Now, for our test scenario we will create and use a functional component ( using hooks ) that has 1 input ( that will use useState ) and 1 prop to use and test.