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

Thinking in React: Inverse Data Flow

Developed with
QA

Contents

keyboard_tab
ReactJS
1
Inverse Data Flow
PREVIEW2m 13s

The course is part of this learning path

ReactJS: Zero to Hero
course-steps
14
certification
5
lab-steps
3
description
1
play-arrow
Inverse Data Flow
Overview
DifficultyBeginner
Duration5m
Students44

Description

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.  

Prerequisites

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. 

Feedback 

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

Transcript

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

Students1742
Labs8
Courses29
Learning paths5

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