Skip to content
Advertisement

Reactjs Dynamically call components having cards under tabpanels using array

This is where Tab header and tab content is defined, expectation is Tabs_content has component name, and under tabpanel it should traverse array tabs_content and display component < AddQueueCard /> and call the component shown in image 3

JavaScript
JavaScript

Currently cards are not called enter image description here Expected output

Advertisement

Answer

Just pass Component itself , but its better to have a separate component dictionary and loop through that for rendering dynamic component, don’t mix component and other things in one array, if you did you have to find a way to detect that item is react component and then render it.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement