簡體   English   中英

<Table>在反應引導程序中 - SyntaxError

[英]<Table> in react-bootstrap - SyntaxError

我正在使用 react-bootstrap 處理 React 項目,並且在嘗試在<Table>部分之前或之后添加 JSX 時遇到問題。

有人熟悉這個問題嗎?

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>

錯誤

您必須將 jsx 包裝在主 div 或 react 片段中。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM