alternative for componentdidmount in react code example
Example: alternative for componentdidmount
import React, { useEffect } from 'react'const SampleComponent = () => { useEffect(() => { // code to run on component mount }, [])return (<div>foo</div>)}export SampleComponent