React Hooks Example with Jest and Typescript

March 07, 2019 0 Comments by

React hooks have landed in core. With all this talk of doing away with classes, I was anxious to try it out.

Bunch of tutorials out there, but the React docs do a great job of explaining how they work. Explaining is one thing. Actual implementation is another. This code shows how this is put together in real-life, and not contrived examples. Simple albeit, but enough to get your feet wet.

I will miss classes and working with instances. For the time being we will be maintaining existing code in classes and writing new functions with hooks, where time permits. This example uses Jest for unit tests and Typescript for static type definitions.

github repo

Tag cloud