Hooks are a way to reuse logic across applications. You write a specific behavior (logic) and “hook” it into any component. This component now can use this logic normally. While React definitely has alternatives for the reuse of logic, we have seen that it is suboptimal – particularly for composition (multiple logics being added to a single component can become too verbose, too hard to debug and too similar to callback hell).
In this tutorial, we’ll be using Cypress to write End to End tests for a Next.js app. Writing tests for your app is really necessary as it gives you the confidence to ship features faster. It essentially helps you remove critical bugs from your product. Writing End to End tests ensures that you test your app how a real user would.
While making a Single Page App with React, it is very easy for your code-base to become unorganized. There are many good libraries in the React ecosystem that can be used to manage certain aspects of the app, this article covers some of them in depth. Other than that, it lists some good practices to follow from the beginning of the project if you have scalability in mind.