Data Fetching in NextJs with High Order Functions
An advanced pattern that speeds up the development of pages by reusing common data and behavior requirements.
In Web Applications, different pages often share data requirements such as information for the currently logged-in user — and behaviors such as authorizing or not a user to see a page.
Imagine a Social Media App and consider that all the authenticated pages have the following requirements:
- The user must be logged in to see the content, otherwise, he is redirected to the login page