reactjs / reactjs/react.dev

The definition of one-way data flow is confusing

Offen
#6,228 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
JavaScript
Sterne
11.8k
Forks
7.9k
Ø Merge
1 T. 11 Std.
Gemergte PRs (30 T.)
11

Beschreibung

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?

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit den verlinkten Abschnitten von Thinking in React, insbesondere „Identify Where Your State Should Live“ und „Add Inverse Data Flow“, und vergleiche, wie sie „one-way data flow“ und „two-way data binding“ verwenden. Erledigt ist die Aufgabe, wenn die Dokumentation diese Konzepte klar voneinander unterscheidet oder die Terminologie erklärt, die die Verwirrung verursacht hat.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, react
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.