1. Home
  2. Training Library
  3. Programming
  4. Courses
  5. Thinking in React: Inverse Data Flow

Thinking in React: Inverse Data Flow

Developed with


Inverse Data Flow

The course is part of this learning path

ReactJS: Zero to Hero
Inverse Data Flow


This module looks at Inverse Data Flow in React    

Learning Objectives 

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

  • Inverse Data Flow 

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 qa.elearningadmin@qa.com to let us know what you think. 


In the fourth step of Thinking in React we identified that the search text and the advanced checkbox value are going to be state in the filterable courses table as they are both needed in the course table component and the search bar component. We're going to be round up the code in the application so far before we think about adding any inverse data flow. You can see that from the code, adding states to the filterable courses table is a quick and simple job to do. State is added in lines 9 and 10 and passed as props to the two sub-components in lines 14 to 22. From the component viewer in the developer tools we can see that the search bar and the course table both now receive the state as props. For demonstration purposes, the initial value of search text has been set to fund. Using the state to calculate the list of courses to display in the course table component is done using plain JavaScript. The values passed in are used to filter courses based on the search text and the billion advanced value. What has been added to the code is the additional props on line 6 and a function that filters the courses' rate based on whether the course name matches the search text, and if advanced-only courses are required. This can be seen on lines 12 to 28. It may seem complicated, but if you take some time to read it through, it's just a setting of logical situations to make sure only the courses the user has requested are displayed. And just to prove that the filtering works, we set the initial value of search text to fund so that the courses displayed are only ones with fund in the name and advanced set to false. The search bar is more complicated because ultimately it needs to be able to provide data to update the state of search text and advanced in its parent component. That's where we're going next. We weren't able to add the onChange functionality to the two input elements and we've got the red warning message on the console. The other warning is telling us that we never used the set state functions in the filterable courses table. So perhaps that's a clue as to what we need to do next.

About the Author
Learning paths6

An outstanding trainer in software development with more than 15 years experience as a Corporate and Apprentice Trainer, ICT Teacher and Head of Department, with a passion for technology and its uses. Continuing to develop existing and new skills and courses, primarily in web design using PHP, JavaScript, HTML, CSS and SQL but also OOP (Java), programming foundations (Using Python), DevOps (Git, CI/CD, etc) and Agile/Scrum. Practically minded, a quick learner and a problem solver with an attention to detail to ensure high quality outcomes.

Covered Topics