diff --git a/ui/pages/index.js b/ui/pages/index.js index fa81a07ce37..16d7b0bf24b 100644 --- a/ui/pages/index.js +++ b/ui/pages/index.js @@ -1,28 +1,26 @@ import { NoSsr } from "@material-ui/core"; import Head from 'next/head'; -import React from "react"; +import React, { useEffect } from "react"; import { connect } from "react-redux"; import { bindActionCreators } from 'redux'; import DashboardComponent from "../components/DashboardComponent"; import { getPath } from "../lib/path"; import { updatepagepath } from "../lib/store"; -class Index extends React.Component { - componentDidMount () { +function Index(props) { + useEffect(() => { console.log(`path: ${getPath()}`); - this.props.updatepagepath({ path : getPath() }); - } + props.updatepagepath({ path : getPath() }); + }, []); - render () { - return ( - - - Dashboard | Meshery - - - - ); - } + return ( + + + Dashboard | Meshery + + + + ); } const mapDispatchToProps = dispatch => ({ updatepagepath : bindActionCreators(updatepagepath, dispatch) }) @@ -30,4 +28,4 @@ const mapDispatchToProps = dispatch => ({ updatepagepath : bindActionCreators(up export default connect( null, mapDispatchToProps -)(Index); \ No newline at end of file +)(Index);