Git Product home page Git Product logo

Comments (4)

rickhanlonii avatar rickhanlonii commented on April 28, 2024

This is documented on these pages, depending on what you're looking to achieve:

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.

woochanleee avatar woochanleee commented on April 28, 2024

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.

rickhanlonii avatar rickhanlonii commented on April 28, 2024

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.

woochanleee avatar woochanleee commented on April 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.