I have a list of array, I would want to match the string with component name, is that possible? I tried this https://codesandbox.io/s/lpzq3jvjm7
function App() {
const obj = {
name: "Name"
};
const capitalize = (s) => {
if (typeof s !== 'string') return ''
return s.charAt(0).toUpperCase() + s.slice(1)
}
return (
<div className="App">
{React.createElement(capitalize(obj.name), {
name: "james"
})}
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
doesn't seem to work, any clue?

import Name from whatever path of that file