score:2

Accepted answer
import React, { useEffect } from 'react';

// Deliberately making this *outside* the component
let loaded = false;

const Home = () => {
  useEffect(() => {
    loaded = true;
  }, []);

  // ...
}

export default Home;

Related Query

More Query from same tag