【发布时间】:2021-01-25 15:05:51
【问题描述】:
我在主页、关于、建模和资源中有导航。我想知道如何从 Jumbotron 添加指向我的导航按钮的链接。
在 App.js 中
function App() {
return (
<div className="App">
<Header />
<Jumbotron />
<Layout>
<Switch>
<Route exact path="/" component={Home} />
<Route path="/about" component={About} />
<Route path="/modeling" component={Modeling} />
<Route path="/resources" component={Resources} />
</Switch>
</Layout>
</div>
);
}
在 Jumbotron.js 中
export const Jumbotron = () => (
<Styles>
<Jumbo fluid className="jumbo">
<div className="overlay"></div>
<Container className="center">
<h1>Welcome 3D astronomical models</h1>
<p>
<button class="btn btn-success btn-lg btn-getStarted" href="#modeling" role="button">Get Started</button>
<button class="btn btn-success btn-lg btn-getStarted" href="#about" role="button">Learn More</button>
</p>
</Container>
</Jumbo>
</Styles>
)
我使用 href="#modeling" 但页面不理解转到页面建模 任何人都可以帮忙吗?我正在使用反应
具体来说,请查看以下链接中的代码: https://codesandbox.io/s/polished-cache-i4xzk?file=/src/App.js
【问题讨论】:
-
您的代码沙箱正在显示
Hello CodeSandbox Start editing to see some magic happen!- 输出中未检测到 jumbotron -
你能再试一次吗?
-
仍然没有输出@Sunny - 你在编辑正确的沙箱吗?我在看
polished-cache-i4xzk -
再试一次。现在可以使用了
-
你能帮我如何将jumbotron的按钮链接到导航栏关于,建模吗?
标签: reactjs react-router react-bootstrap