你好,你们好吗?我正在构建我的第一个React应用,并且遇到了导致我的navbarLinks无法在屏幕上呈现的问题。当我将鼠标悬停在redux开发工具中的Navlink上时,它显示Navlinks在其中,但未在屏幕上呈现。我不确定是什么问题。可以帮我一下。预先谢谢你。
import React, { Component } from 'react';
import Header from './headernavbar/header';
import Navbar from './headernavbar/navbar';
import About from './about';
import Skill from './skill';
import Portfolio from './portfolio';
import Contact from './contact';
import { connect } from 'react-redux';
import * as actions from '../actions';
class Home extends Component {
componentDidMount(){
const navbarLinks = [
{
_id: 0,
title: 'Home',
active: true,
Component: <Home/>
},
{
_id: 1,
title: 'About',
active: false,
Component: <About/>
},
{
_id: 2,
title: 'Skills',
active: false,
Component: <Skill/>
},
{
_id: 3,
title: 'Portfolio',
active: false,
Component: <Portfolio/>
},
{
_id: 4,
title: 'Contact',
active: false,
Component: <Contact/>
}
]
this.props.setHeaderLinks([]);
this.props.setNavbarLinks([navbarLinks]);
}
render() {
return (
<div className='home-layout'>
{this.props.children}
<Header/>
<Navbar/>
</div>
);
}
}
Home = connect(null, actions)(Home);
export default Home;