Very good to all and I hope you can help me, I have a component called Content which should be able to receive and then show according to the user's action one or another component, my question is, How I do to show a dynamic child component and what would be the best practice for it?
The content component is thus according to React in its part of Containment :
import React, { Component } from 'react';
class Contenido extends Component {
constructor(props){
super(props)
}
render() {
return (
<div className="container-fluid">
{this.props.children}
</div>
)
}
}
export default Contenido
and this is what I have so far in the component that matters to the Content component:
render () {
return (
< Contenido>
< Publicaciones/>
< /Contenido>
)
}
It is worth highlighting if you realize that within Content another component called Publications passes, the idea is to pass there dynamically, by default it would be Publications strong> but imagine that the user clicks on a menu and another component should be displayed there.
It would be something like this:
render () {
return (
< Contenido>
< Publicaciones/>
ó
< OtroComponente/>
ó
< OtroComponente/>
ó
...
< /Contenido>
)
}
I hope you can explain me.