Introduction to Hooks
Start course

This module looks at how to work with External Data in React. You’ll be looking at Class Components, Effect Hooks, and how to handle data.  

Learning Objectives 

The objectives of this module are to provide you with an understanding of: 

  • The component lifecycle  
  • Hooks in React  
  • How to create restful services  
  • How to use an Effect Dependency Array  
  • How to hand errors in data requests 
  • How to send data   

Intended Audience

This learning path is aimed at all who wish to learn how to use the ReactJS framework.  


It is essential you understand the face of contemporary web development to attend this course. We insist upon JavaScript experience, along with good HTML and CSS skills. 


We welcome all feedback and suggestions - please contact us at to let us know what you think. 


- [Narrator] Facebook have moved to promote the use of function components. And to do this, react needed a mechanism to add state to them and also to support other features. One of the main objectives was to make any new way of creating components backwards compatible. React version 16.8 is the one with hooks. But what are hooks? Hooks, let you literally hook into react state and lifecycle features. In terms of function components, this solved the rafter problems encountered by the react team. These being, the reuse of stateful logic between components, the splitting of complex components into smaller functions based on their relationships and the simplification of code syntax. Class components being simplified to functional components is much like syntax and code required. It makes the building optimization process better. As there's less to transpire. To reiterate, there is no need to rewrite class components in applications as functions as class components will always be valid. It's just recommended that new components should be built as functions using hooks. SWAT hooks are available in react and what do they do. There were a few hooks built into the library already. If you've covered the content on thinking in react we use the state to allow function components to have state. Another hook that is commonly used out of the box is the effect hook. The effect hook is the one that allows us to hook into the lifecycle methods that we would see in a class component to perform side effects, hence its name. We'll go into more detail about this hook later. React has some other hooks and we'll look into the use content and use reducer hooks, when we investigate other state management techniques. There's also use Memo, use Callback, use ref, use imperative handle, use layout effect and use debug value. The last one, use debug value is perhaps the most interesting for developers as it lets us display label for custom hooks in the dev tools. And talking of custom hooks. We aren't limited to those hooks provided by react. We can create custom hooks to do almost anything we need them to. As long as we follow the rules for hooks and the steps for creating our own hook as outlined in reacts official documentation.

About the Author
Learning Paths

Ed is an Outstanding Trainer in Software Development, with a passion for technology and its uses and holding more than 10 years’ experience.

Previous roles have included being a Delivery Manager, Trainer, ICT teacher, and Head of Department. Ed continues to develop existing and new courses, primarily in web design using: PHP, JavaScript, HTML, CSS, SQL, and OOP (Java), Programming Foundations (Python), and DevOps (Git, CI/CD, etc). Ed describes himself as practically minded, a quick learner, and a problem solver who pays great attention to detail. 

Ed’s specialist area is training in Emerging Technologies, within Web Development. Ed mainly delivers courses in JavaScript covering vanilla JS, ES2015+, TypeScript, Angular, and React (the latter is authored by Ed) and has delivered on behalf of Google for PWAs. Ed has also developed a new suite of PHP courses and has extensive experience with HTML/CSS and MySQL. 

Ed is responsible for delivering QA’s Programming Foundations course using the Eclipse IDE. His skillset extends into the DevOps sphere, where he is able to deliver courses based around Agile/Scrum practices, version control, and CI/CD.

Covered Topics