Thinking in React: Inverse Data Flow
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 to let us know what you think. 


In the fourth step of thinking in React, we identified that the searchText and the advanced checkbox value are going to be state in the FilterableCoursesTable, as they are both needed in the CourseTable component and the SearchBar component. We're going to 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 state to the FilterableCoursesTable is a quick and simple job to do. State is added in lines 9 and 10, and pass these props to the two sub-components in lines 14 to 22. From the component viewer in the developer tools, we can see that the SearchBar and the CourseTable both now receive the state as props. 

For demonstration purposes, the initial value of searchText has been set to fund. Using the state to calculate the list of courses to display in the CourseTable component is done using plain JavaScript. The values passed in are used to filter courses based on the searchText and the Boolean advanced value. What has been added to the code is the additional props on line 6 and a function that filters the courses array based on whether the course name matches the searchText, 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 to set in the logical situations to make sure only the courses the user has requested are displayed. And just to prove that the filtering works, we've set the initial value of searchText to fund so that the course is displayed and 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 status search texts and advance in its parent component. That's where we're going next. We weren't able to add the on change 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 FilterableCoursesTable. So perhaps that's a clue as to what we need to do next.

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