What is Closures is javascript

Closures 

Function along with its lexical scope bundled together forms a closure. it's called Closures.

How to cancel/abort ajax request in axios

useEffect(() => {    const ourRequest = Axios.CancelToken.source() // <-- 1st step      const fetchPost = async () => {      try {        const response = await Axios.get(`endpointURL`, {          cancelToken: ourRequest.token, // <-- 2nd step        })        console.log(response.data)        setPost(response.data)        setIsLoading(false)      } catch (err) {        console.log('There was a problem or request was cancelled.')      }    }    fetchPost()      return () => {      ourRequest.cancel() // <-- 3rd step    }  }, [])

Add preact in nextjs


  webpack: (config, { isServer }) => {
   // config.plugins.push(new webpack.EnvironmentPlugin(myEnv));

    if (!isServer) {
      Object.assign(config.resolve.alias, {
        react: 'preact/compat',
        'react-dom/test-utils': 'preact/test-utils',
        'react-dom': 'preact/compat',
      });
    }


    return config;
  }