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

1 Answer 1

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>
         </>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.