Answers for "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"

1

Adjacent JSX elements must be wrapped in an enclosing tag

// Incorrect
return(
    <div id="div1"></div>
    <div id="div1"></div>
  )

// Correct

 return(
      <div id="parent">
        <div id="div1"></div>
        <div id="div1"></div>
      </div>
      )
Posted by: Guest on April-30-2021
-1

Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?

render() {
  return (
    <React.Fragment>
      <ChildA />
      <ChildB />
      <ChildC />
    </React.Fragment>
  );
}
Posted by: Guest on January-11-2021

Code answers related to "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"

Code answers related to "Javascript"

Browse Popular Code Answers by Language