Implementing Requests and React Suspense

In the previous chapters, we learned how to use React context as an alternative to manually passing down props. We learned about context providers, consumers, and how to use Hooks as a context consumer. Next, we learned about inversion of control as an alternative to contexts. Finally, we implemented themes and global state, using contexts in our blog app.

In this chapter, we are going to set up a simple backend server, which will be generated from JavaScript Object Notation (JSON) file, using the json-server tool. Then, we are going to implement requesting resources, by using an Effect Hook in combination with a State Hook. Next, we are going to do the same, using the axios and react-request-hook libraries. Finally, we are going to take a look at preventing unnecessary re-rendering, using React.memo, and lazily loading components through the use of React Suspense.

The following topics will be covered in this chapter:

  • Requesting resources using Hooks
  • Preventing unnecessary re-rendering with React.memo
  • Implementing lazy loading using React Suspense
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.70.101