Closed PenguinBoi12 closed 3 months ago
https://github.com/notiflix/Notiflix/issues/75 Issue I am guessing is that the init() may be trying to reference a DOM element somehow, or needs to be somewhere within useEffect. Calling init() in a use effect causes it to work as expected.
Refactor notiflix-config to now have a wrapped useEffect hook that initializes config on page load
function useNotify() {
useEffect(() => {
Notify.init({
...
})
}
export {
Notify, useNotify
}
Then to use:
import {Notify, useNotify} from '@config/notiflix-config';
export default function Page() {
useNotify();
// Use the same as before
Notify.success("Loaded!");
}
Investigate notiflix throwing a weird "cannot read properties of undefined" when page is loaded. (see image bellow)![image](https://github.com/Code-Society-Lab/cursif-web/assets/49426163/02ebb17f-8827-4def-9794-e9afa95bd6fc)