Home > Enterprise >  How to create multi line componts react
How to create multi line componts react

Time:09-15

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;

CodePudding user response:

You just need to render the children.

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

export default Form;

For more, please refer JSX Components as mentioned by @Sergey Sosunov

  • Related