GithubHelp home page GithubHelp logo

Comments (3)

sophiebits avatar sophiebits commented on May 3, 2024 1

The goal is for React to pass a props object through unchanged in the future, mainly for performance reasons (reactjs/rfcs#107). At that time, this would work (though likely not with the createElement API directly; rather the new jsx ones that are intended as a compile target).

Using JSX is the idiomatic way to write React and symbol properties are not supported there so I would not really recommend trying to do this anyway. I would recommend using a different property naming convention or finding another way entirely to pass this data.

from react.

eben-vranken avatar eben-vranken commented on May 3, 2024

Isn't this just how React normally processes and handles props?

When you use React.createElement and pass props, React essentially serializes and deserializes them. In this process, non-serializable values like Symbols or functions will be lost, as you've noticed.

from react.

misaka42 avatar misaka42 commented on May 3, 2024

@eben-vranken Thank you for your response. But with this scenario we are discussing here is not about passing props from a server component to a client component. i mean there is no process of serializing props via network, We are talking about the normal case of passing props between two React components. In this situation, passing functions (just like event handler) is obviously possible. Therefore, I would like to enhance it to allow the passing properties of symbols.

from react.

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.