Aug 3, 2024
npm init vite@latest
to create a new React project.npm install
.npm run dev
.header.jsx
in the src
folder.App.jsx
by importing it.footer.jsx
.props
object in the child component.const [state, setState] = useState(initialValue)
.useState
for managing tasks and useEffect
for side effects.setInterval
.useEffect
to clear the interval when the component unmounts.useRef
and useState
to manage running state.useState
, useEffect
, and useRef
make managing state and side effects straightforward.