Consider the following data I am getting as a string:
a, b, c are a form of variables that I am importing from a config file as string.
const str = 'a, b, c, d, e, f, g'
{React.createElement(Components[someComponent],{...str})}
What am I doing wrong or what can be changed? Also we can make changes in the config file but it consists of an array of multiple objects.
If there is any way to get the string converted in such format it can solve the problem.
const str = {a, b, c, d, e, f, g};
Then I can simply pass it on.
2
Answers
hi If you want to send as props, your code should be like below
React.createElement(Components[someComponent], { str: str })
You can do something like this