React bootstrap and other similar bootstrap libraries provide something like
import Modal from '...';
whereas Modal can be unpacked further into:
const { Header, Title, Description } = Modal;
Although Modal itself is a wrapper component.
Sample of their use-case is as such:
<Modal someProps={someValues}>
<Modal.Title>Some Title</Modal.Title>
<Modal.Content>Some Content</Modal.Content>
</Modal>
How does one develop something like that?
My initial thought was something like this:
const Title = ({children}) => (<something>{children}</something>);
const Content = ({children}) => (<something>{children}</something>);
export {
Title,
Content,
};
====================
import Modal from '...';
--or--
import { Title, Content } from '...';
but this method will cause Modal to not be usable by itself. How does this work? Does anyone have an example?
Thanks!