Window is not defined
I have this component for the past 2 months and it was working fine but today it is giving an error. I cant build my react app. If I comment out this component then my app works fine. When I build my app it gives this error:
ReferenceError: window is not defined
at new CountUp (C:\xampp\htdocs\mellow-nextauth\node_modules\countup.js\dist\countUp.umd.js:146:13)
at createCountUpInstance (C:\xampp\htdocs\mellow-nextauth\node_modules\react-countup\build\index.js:154:10)
at C:\xampp\htdocs\mellow-nextauth\node_modules\react-countup\build\index.js:203:12
at C:\xampp\htdocs\mellow-nextauth\node_modules\react-countup\build\index.js:135:24
at C:\xampp\htdocs\mellow-nextauth\node_modules\react-countup\build\index.js:212:22
at C:\xampp\htdocs\mellow-nextauth\node_modules\react-countup\build\index.js:135:24
at CountUp (C:\xampp\htdocs\mellow-nextauth\node_modules\react-countup\build\index.js:388:37)
at d (C:\xampp\htdocs\mellow-nextauth\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:33:498)
at bb (C:\xampp\htdocs\mellow-nextauth\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:36:16)
at a.b.render (C:\xampp\htdocs\mellow-nextauth\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:42:43)
@NabeelAhmed23 could you provide any details here? Version of react-countup, the repro if it's possible, is it ok with prev versions?
Using "react-countup": "^6.2.0",
Started happening to me too once I bumped to latest and react 18
Edit: Rolled back countup but kept react at 18 and it's definitely a change with react 18, probably an easy fix
created a PR in countUp.js, which will fix this issue: https://github.com/inorganik/countUp.js/pull/286
Thanks @johakr , your PR is merged and it's fixed in CountUp v2.3.1