-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
It would be cool if JSON values could be passed as props to the react component, similar to JSX.
E.g. <MyComponent items={[1, 2, 3, 4]} /> or <MyComponent items={{a: 1, b: 2, c: 3}} />.
const MyComponent = ({ items }) => {
return <>{items.map(item => String(item))}</>;
};This would be more convenient compared to the current workaround of passing stringified JSON: <MyComponent items='{"a": 1, "b": 2, "c": 3}' />.
const MyComponent = ({ items }) => {
items = JSON.parse(items);
return <>{items.map(item => String(item))}</>;
};Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels