Comments (4)
This is documented on these pages, depending on what you're looking to achieve:
- Passing props to a component
- Passing event handlers as props
- Sharing state between components
- Passing data deeply with context
The .bind
specific technique is briefly mentioned in the Legacy Component docs here, but createReactClass
is deprecated and will not be added to the new site. See the legacy site for createReactClass
docs.
from reactjs.org.
Nowhere in the documentation does it say.
For communication between two components that don't have a parent-child relationship, you can set up your own global event system. (Old React Docs said)
Is using a global event system not a good practice and only using context(or lifting state up) is best practice?
from reactjs.org.
Correct, the only way to do it safely with concurrent features today is to de-opt with useSyncExternalStore, which has limitation such as forcing fallbacks for existing content. We're aware this is a pain point, though we don't have any solutions to recommend until we build better support for it.
from reactjs.org.
Thank you. I found an example that uses useSyncExternal
, I'll check it out.
facebook/react#14988 (comment)
https://codesandbox.io/p/sandbox/hopeful-sara-fb970f?file=%2Fsrc%2Findex.js%3A1%2C1-47%2C1
I would be happy if React provided a built-in event emitter system like Angular, Vue. π
from reactjs.org.
Related Issues (20)
- [Suggestion]: Add example for retry with the `use` hook and an error boundary
- [Suggestion]: How to use local language search on a translation website
- [Suggestion]: Clarification on react.cache Usage in Server Requests
- [Typo]: Possible incorrect info HOT 1
- [Suggestion]: "falsy" values not in the new documentation HOT 2
- [Bug]: sidepanel is blocking main content HOT 3
- [Suggestion]: Change the error message "Objects are not valid as a React child (found: object with keys {aaa, bbb}). If you meant to render a collection of children, use an array instead.
- [Mistake]: getVisibleTodos() does not re-run (and does not print any logs) when you type into the input to begin with! HOT 2
- δΈζζζ‘£ε·²η»uiεε½’δΊ HOT 1
- Class domain layer HOT 5
- Renren_kim86
- te.react.dev Maintainer's Issue HOT 3
- [Bug]: Search functionality not working correctly on react.dev in Safari on iOS real device (iPhone 12 Pro) HOT 4
- [Bug]: Search functionality not working correctly on react.dev in Safari on iOS real device (iPhone 12 Pro) HOT 3
- [Typo]: There is a syntax mistake on react docs GetStarted/Installation/Using Typescript HOT 2
- [Typo]: em dash spacing HOT 1
- Should have a queue HOT 1
- [Bug]: The example code for `hydrateRoot` seems to be wrong HOT 1
- [Bug]: Part of sample code on "Strict Mode" page doesn't work HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactjs.org.