this really sound like a simple thing to know but I couldn't find any articles/resources so asking here.
how can I create components like Form.Input, Form.Select and use as follows -
import Form from '../Form';
...
const MyComponent = (props) => {
...
return (
<Form>
<Form.Input />
<Form.Select />
</Form>
);
}
So I basically want to understand what Form
component is like that it is behaving like an object with sub exports like Input as Form.Input
and Form.Select
.
I've seen such codes at some places. Also we use React.Component
, don't we?
I only know to export default and named components so I can create different exports like Input and Select but can't figure out how exporting Form.Input could work ?