I have an object with keys and values. I'd like to render a certain keys value in my react JSX markup like this:
const VALUES = {
"key1": "value 1",
"key2": "value 2",
}
const MyComponent = ({name}) => (
VALUES[name] || ""
)
but this does not work. While it is legal to render strings directly in JSX like this: <span>A string</span> the code above fails with an error saying "inst.render is not a function" in _renderValidatedComponentWithoutOwnerOrContext.
It works if the values look like this:
const VALUES = {
"key1": <span>value 1</span>,
"key2": <span>value 2</span>,
}