【发布时间】:2019-11-06 20:04:46
【问题描述】:
这是我项目的一部分。我想创建一个带有股票仪表板的 Web 应用程序。
我的代码有点问题:image
我想在我的浏览器上显示一个登录表单。我使用 React.js、Node.js 和 Npm。我这样写了这个 index.js:
import React from 'react';
import ReactDOM from 'react-dom';
import {
BrowserRouter as Router,
Route,
Link,
Switch
} from 'react-router-dom'
import App from './client/App';
import NotFound from './client/NotFound';
import Home from './Home';
import HelloWorld from './client/HelloWorld';
import './client/styles.scss';
ReactDOM.render((
<Router>
<App>
<Switch>
<Route exact path="/" component={Home}/>
<Route path="/helloworld" component={HelloWorld}/>
<Route component={NotFound}/>
</Switch>
</App>
</Router>)
, document.getElementById("app"));
然后,我也这样写了这个 index.html 文件:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> Web Application </title>
<!-- link rel="icon" type="image/png" href="/assets/img/logo.png" -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600">
</head>
<body>
<div id="app"></div>
</body>
<script type="javascript" src="index.js"> </script>
</html>
【问题讨论】:
-
我的回答是否有意义/解决了您的问题?
标签: javascript node.js reactjs npm mern