reactjs / reactjs/react.dev

The definition of one-way data flow is confusing

Ouverte
#6,228 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
JavaScript
Étoiles
11.8k
Forks
7.9k
Merge moyen
1 j 11 h
PR mergées (30 j)
11

Description

I was researching about data binding concept.
then found followings.

  1. one-way data binding
  2. two-way data binding

What I understand about data binding is about how Data and View are affecting each other.

  1. one-way data binding is using event-listener function to achieve View to Data Data to View together.
    (i.e, displaying input value in <p> tag.)
  2. two way data binding is using the binding syntax (not using event-listener) and it can achieve View to Data Data to View
    (i.e, displaying input value in <p> tag.)

but when I read the official React document on react.dev.

It talks about one way data flow which is a bit confusing expression then it says this concept is about top to bottom parent to child. (which is completely different from the definition of one-way data binding).

// from the link below.
Remember: React uses one-way data flow, passing data down the component hierarchy from parent to child component.

https://react.dev/learn/thinking-in-react#step-4-identify-where-your-state-should-live

then when it talks about two way data binding the document brings displaying the input value on screen.
Which is not related to topic about Top to Bottom.

// from the link below.
React makes this data flow explicit, but it requires a little more typing than two-way data binding. If you try to type or check the box in the example above, you’ll see that React ignores your input. 

https://react.dev/learn/thinking-in-react#step-5-add-inverse-data-flow

I feel like this concept needs to be updated to clarify the concept of data binding.
or if the document content is correct, Can someone explain what I am missing or confused about this document?

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par les sections liées de Thinking in React, en particulier « Identify Where Your State Should Live » et « Add Inverse Data Flow », et comparez la manière dont elles utilisent « one-way data flow » et « two-way data binding ». Le travail est terminé lorsque la documentation distingue clairement ces concepts ou explique la terminologie à l’origine de la confusion.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript, react
Domaine
documentation
Type d'issue
Documentation
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.