无法在反应中导入按钮
Can't import button in react
我需要一些帮助来导入 react
中的 button
,我对反应完全陌生
我创建了一个 table
,我在其中显示 data
到 JSON
,现在我想在 table 下面添加一个 button
,当用户点击它时,它将重定向到一个新页面
我的 js 文件中有 imported
按钮
import { Button } from 'react-native';
我在渲染中使用了 Button
HTML as
<Button variant="primary">Primary</Button>
代码片段
import React from 'react';
import { Table } from 'react-bootstrap';
import { Button } from 'react-native';
import '../scss/components/table';
import data from '../../public/userData';
export default function ReservedListView() {
console.log('data :' + JSON.stringify(data));
let header = Object.keys(data[0]);
console.log('header :' + header);
return (
<div>
<table id="students" class="table">
<tbody>
<tr>
<th>Name</th>
<th>Date</th>
<th>Day</th>
<th>SimeSlot</th>
</tr>
{data.map((el, index) => (
<tr>
<td>{el.name}</td>
<td>{el.date}</td>
<td>{el.day}</td>
<td>{el.timeSlot}</td>
</tr>
))}
</tbody>
</table>
<Button variant="primary">Primary</Button>
</div>
);
}
导入按钮时出现此错误
您正在使用 React 进行开发,但您想从 react-native 导入按钮?
React 中不能只使用普通按钮吗?
我需要一些帮助来导入 react
中的 button
,我对反应完全陌生
我创建了一个 table
,我在其中显示 data
到 JSON
,现在我想在 table 下面添加一个 button
,当用户点击它时,它将重定向到一个新页面
我的 js 文件中有 imported
按钮
import { Button } from 'react-native';
我在渲染中使用了 Button
HTML as
<Button variant="primary">Primary</Button>
代码片段
import React from 'react';
import { Table } from 'react-bootstrap';
import { Button } from 'react-native';
import '../scss/components/table';
import data from '../../public/userData';
export default function ReservedListView() {
console.log('data :' + JSON.stringify(data));
let header = Object.keys(data[0]);
console.log('header :' + header);
return (
<div>
<table id="students" class="table">
<tbody>
<tr>
<th>Name</th>
<th>Date</th>
<th>Day</th>
<th>SimeSlot</th>
</tr>
{data.map((el, index) => (
<tr>
<td>{el.name}</td>
<td>{el.date}</td>
<td>{el.day}</td>
<td>{el.timeSlot}</td>
</tr>
))}
</tbody>
</table>
<Button variant="primary">Primary</Button>
</div>
);
}
导入按钮时出现此错误
您正在使用 React 进行开发,但您想从 react-native 导入按钮?
React 中不能只使用普通按钮吗?