Custom hook to debug useEffect Sample in 2020

Custom hook to debug useEffect Sample in 2020


tutorials -

useDebug

Custom hook to debug useEffect.

install

Uses the useEffect hook from React 16.7+

npm install usedebug

 

usage

import React from "react"
const useDebug = require("usedebug")

function MyComponent() {
  useDebug("mycomponent") // call useDebug with an optional id
  return <div>Hey!</div>
}

Check the console to see logs

__DEBUG_mycomponent__ mounted 
__DEBUG_mycomponent__ unmounted

GitHub

Trending On Tutorial Stuff

Our Sponsors

Top Applications in Tutorial Stuff

Top Experts In Tutorial Stuff