javascript - 从 Create-React-App 升级到 Next.js - 什么都没有显示
问题描述
我开发了一个 Next.js 服务器端渲染应用程序。我需要使用像这样的客户端渲染反应应用程序来创建时间线。
我在我的应用程序中使用它的步骤:
我刚刚将 src 文件夹内容复制到我自己的应用程序的“页面”文件夹中。
在我的应用程序的 routes.js 文件中,我提供了 App.js 的导航。
为了将 CSS 与 Next.js 一起使用(根据此链接):
我从 Next 导入 Head 并添加了指向 CSS 文件的链接。
所以,文件(App.js)现在看起来像这样:
import React, { Component } from 'react';
import Timeline from './components/Timeline';
import Head from 'next/head';
class App extends Component {
state = {
timelineData: [
{
text: 'Wrote my first blog post ever on Medium',
date: 'March 03 2017',
category: {
tag: 'medium',
color: '#018f69'
}
},
{
text: 'This is the second timeline item',
date: 'September 22 2017',
category: {
tag: 'tag-two',
color: '#018f69'
}
}
]
}
render() {
return (
<div className="App">
<Head>
<link href="/App.css" rel="stylesheet" />
</Head>
<Timeline data={this.state.timelineData} />
</div>
);
}
}
export default App;
但是,现在当我转到该页面时,什么都没有显示,也没有错误。
有人可以告诉我如何解决这个问题吗?
解决方案
推荐阅读
- excel - 通过 excel vba 进行网页抓取
- javascript - 为什么我得到一个'?使用 useHistory().push('/') 后在链接末尾标记
- node.js - 如果字段的值在猫鼬中达到 0,则减少字段并删除整个对象
- javascript - 在共享的 NodeJS 服务器上运行应用程序
- mongodb - 在发布获取期间安装包?
- swift - Swift - 来自服务器的日期不断转换为我的本地时区
- javascript - Vue、Vuex 和远程存储
- angular - 创建单位转换输入和下拉列表(Angular 9 动态表单)
- android - Admob 原生广告挂起 UI
- swift - 键盘偏移在 SwiftUI 2 中不再起作用