npm run start在终端中运行时出现以下错误。
尝试导入错误:“重定向”未从“react-router-dom”导出。
我已经重新安装了node_modules,,react-router-dom。react-router还重新启动了终端和我的计算机,但问题仍然存在。
我的代码:
import React from 'react';
import { Switch, Redirect } from 'react-router-dom';
import { RouteWithLayout } from './components';
import { Minimal as MinimalLayout } from './layouts';
import {
Login as LoginView,
Dashboard as DashboardView,
NotFound as NotFoundView
} from './views';
const Routes = () => {
return (
<Switch>
<Redirect
exact
from="/"
to="/dashboard"
/>
<RouteWithLayout
component={routeProps => <LoginView {...routeProps} data={data} />}
exact
layout={MinimalLayout}
path="/login"
/>
<Redirect to="/not-found" /> …Run Code Online (Sandbox Code Playgroud) 我试图让调光器仅在点击ETH或Select a token按钮点击时显示。我什至无法让状态部分工作,所以我可以连接按钮。
function Main () {
const [accountAddress, setAccountAddress] = useState(null);
const [show, setShow] = useState(false);
return (
<div ref={contextRef}>
<Dimmer.Dimmable as={Segment} dimmed={show}>
<Grid style={styles.grid}>
<Grid.Row>
<Grid.Column>
<Card style={styles.card} centered>
<Card.Content>
<Card.Header style={styles.padding}>Swap / Pool</Card.Header>
<Input style={styles.padding} fluid type='text' placeholder='0.0'>
<Label basic>From</Label>
<input />
<Button>ETH <Icon name='angle down' /></Button>
</Input>
<Input style={styles.padding} fluid type='text' placeholder='0.0'>
<Label basic>To</Label>
<input />
<Button>Select a Token <Icon name='angle down' /></Button>
</Input>
<Button style={styles.padding} color='teal' fluid size='large'>
Connect Wallet
</Button> …Run Code Online (Sandbox Code Playgroud)