Closed karanshah229 closed 1 year ago
Working with next-js (same stack as yours, one minor version up on Next and React.
I managed to get the Babel integration working also. Initially I followed the steps explained here: and that worked.
// (guarantee useEffect deps are in sync with useWhatChanged) let deps = [a, b, c, d]
useWhatChanged(deps, 'a, b, c, d'); useEffect(() => { // your effect }, deps);
As mentioned, following the instructions here for the Babel installation in Next.js worked - note, you'll need to restart Node to get the Babel config to load.
That code you've provided as an example here isn't using the babel plugin though so is a little confusing. That would work without the plugin as it's using the useWhatChanged direct call. The babel plugin allows you to use // uwc-dubug
above your hooks to automatically debug.
I can confirm that I have it working using the config provided in the linked repo though.
Stack:
"next": "^13.1.0", "react": "^18.1.0", "react-dom": "^18.1.0", "react-redux": "^7.2.0"