I have this react component that is not an ES6 class. It's a const like :
import React from 'react';
import Dashboard from './components/Dashboard';
const Home = (props) => {
    const componentDidMount = () => {
        console.log('component mounted'); // not working
    }
    return <Dashboard />;
}
Inside this const how do i define the componentDidMount function like i would do in a normal ES6 class? this is how i did it before.
import React from 'react';
import Dashboard from './components/Dashboard';
class Dashboard extends React.Component {
    componentDidMount() {
        console.log('component mounted');
    }
    render() {
        return <Dashboard />;
    }
}
 
     
    