First of all, we are going to test a very simple Hook that does not make use of contexts or asynchronous code such as timeouts. To do this, we are going to create a new Hook called useCounter. Then, we are going to test various parts of the Hook.
The following tasks will be covered in this section:
- Creating the useCounter Hook
- Testing the result
- Testing Hook actions
- Testing the initial value
- Testing reset and forcing re-rendering
Let's get started now.