I wish React had something like Dynamic Components. Looks like I'll have to dust off my Vue experience and build something fun like this. Just in time for Vue 3 😊
I think it does Sean, try searching "dynamic component React" and you'll see a few tutorials. I haven't worked with React myself I must admit, so perhaps they have different meaning attached to "dynamic component". When I get chance I'll look into it myself and update the article.
An experienced software developer with a strong background in developing award-winning web and mobile applications for diverse clients with 6+ years of industry experience.
JSX compiles down to React.createElement and that is what we are leveraging on.
I am destructuring each item in the data to extract "is" property and passing the rest of prop to the rendered component or HTML element.
If the "is" property is not in customComponents object it will fallback to render it as normal HTML tag.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I wish React had something like Dynamic Components. Looks like I'll have to dust off my Vue experience and build something fun like this. Just in time for Vue 3 😊
I think it does Sean, try searching "dynamic component React" and you'll see a few tutorials. I haven't worked with React myself I must admit, so perhaps they have different meaning attached to "dynamic component". When I get chance I'll look into it myself and update the article.
There is Dynamic components, taking this JSON data:
You can write a renderer like this:
JSX compiles down to React.createElement and that is what we are leveraging on.
I am destructuring each item in the data to extract "is" property and passing the rest of prop to the rendered component or HTML element.
If the "is" property is not in
customComponents
object it will fallback to render it as normal HTML tag.