-
Notifications
You must be signed in to change notification settings - Fork 49k
Closed
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug
Description
React version: all
Steps To Reproduce
import React from "react";
const KEY_OF_A = Symbol.for("a");
const KEY_OF_B = "b";
export default function App() {
return React.createElement(Foo, {
[KEY_OF_A]: "A",
[KEY_OF_B]: "B"
});
}
function Foo(props) {
return React.createElement(
"text",
null,
props[KEY_OF_A] + "__" + props[KEY_OF_B]
);
}
// -> undefined__B
Link to code example: https://codesandbox.io/s/jolly-wright-gzlxf7?file=/src/App.js
The current behavior
react/packages/react/src/ReactElement.js
Line 391 in 3808b01
for (propName in config) { |
// Remaining properties are added to a new props object
for (propName in config) {
if (
hasOwnProperty.call(config, propName) &&
!RESERVED_PROPS.hasOwnProperty(propName)
) {
props[propName] = config[propName];
}
}
The expected behavior
I'm not sure if it was intended to be designed this way, but I currently have a scenario where I need to inject some private variables into user components from the framework layer. However, these symbols are being removed during the process of passing them. So I'm wondering if it's possible to design this part to support the passing of symbol attributes?
Metadata
Metadata
Assignees
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug