2

I'm working on a React project using react-bootstrap, and having a problem when trying to add JSX before of after the <Table> part.

Someone familiar with that problem?

return (
    
    <h1>My Schedule</h1>
    
    <Table striped bordered hover>
      <thead>
        <tr>
          <th>Time</th>
          <th>Medicine Name</th>


SyntaxError: C:\Users\hardu\Desktop\Web Development\Medisafe\dashboard\src\pages\Schedule.js: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?(22:4)       

  20 |     <h1>My Schedule</h1>
  21 |
> 22 |     <Table striped bordered hover>
     |     ^
  23 |       <thead>
  24 |         <tr>
  25 |           <th>Time</th>

error

matiaslauriti
  • 7,065
  • 4
  • 31
  • 43
Yonatan
  • 23
  • 4

1 Answers1

1

You have to wrap your jsx in a main div or a react fragment.

return (
    <>
    <h1>My Schedule</h1>
    
    <Table striped bordered hover>
      <thead>
        <tr>
          <th>Time</th>
          <th>Medicine Name</th>
         </>
kevin
  • 872
  • 5
  • 18