Uni-directional or one-way data flow in React JS — SS Blog

Uni-directional or one-way data flow in React JS — SS Blog

What is the uni-directional data flow?

In React, the state is used to store the data related to the components and pass that state as pros(data coming from parents is being called props) to the child components
Phenomena of passing data from parent to child component are called the uni-directional or one-way data flow.

The uni-directional data flow has some advantages, these are

  1. Easier debugging
  2. Less prone to errors
  3. it’s more efficient because the library already knows what the boundaries are of each part of the system

Changing the state of a component will never affect its parent or the siblings, only the children will be affected. This is the main reason that the state is often moved up in the component tree so that it can be shared between the components that need to access it.

But there are certain situations where we need to pass the data from the child to the parent component:
In that case, we can store the state in the nearest Parent component and then pass the data as props to the child components and Parent component can make the necessary state change and the new state gets passed to its child components.

Get certification for your knowledge in the fundamentals of Computer functioning by clearing the Computer Certification exam conducted by StudySection. After going through this Computer Certification Exam, you will be able to evaluate your basic knowledge of computers.

Originally published at https://studysection.com on March 21, 2022.

--

--

The most loved online platform for eCertification in several subjects including but not limited to Software Development, Aptitude and more.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Study Section

Study Section

The most loved online platform for eCertification in several subjects including but not limited to Software Development, Aptitude and more.