Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 当我在componentDidMount中设置标题时,如何在服务器端获取标题?_Reactjs_Server_Rendering - Fatal编程技术网

Reactjs 当我在componentDidMount中设置标题时,如何在服务器端获取标题?

Reactjs 当我在componentDidMount中设置标题时,如何在服务器端获取标题?,reactjs,server,rendering,Reactjs,Server,Rendering,我想知道你是如何用ReactJS设置每页的标题的 对于渲染方法中的标题,应该使用状态变量,如果使用Redux,则应该使用Prop <title>{this.state.pageTitle}</title> componentDidMount(){ this.setState({pageTitle: pageDataStore.title}) }

我想知道你是如何用ReactJS设置每页的标题的


对于渲染方法中的标题,应该使用状态变量,如果使用Redux,则应该使用Prop

<title>{this.state.pageTitle}</title>
componentDidMount(){
 this.setState({pageTitle: pageDataStore.title})
}