Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to create multi line componts react

Hi was was wondering how to make a multi line component instead of an component with a self closing that for example so i can add taggs html insde the commonent but i that i can reuse the from component for multiple forms

<Form>
  //Some text fields
</Form>

and the component

const Form = () => (
  <form>
    //Add here the tags inserted between the opening and closeing tag
  </form>
)

export default From;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You just need to render the children.

const Form = ({children}) => (
  <form>
    //Add here the tags inserted between the opening and closeing tag
    {children}
  </form>
)

export default Form;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading