1

I'm trying to trigger Messages on useEffect[]
but not working since the current ref is null, any idea ? when I log the ref (pageNotification) on mount it shows null

enter image description here

I'm using react webpack TS

if I don't use chaining option will return error

Uncaught TypeError: Cannot read properties of null (reading 'show')

The issue is my Messages component (notification) not runnning based on my useEffect because my ref.current return null, then i try to remove these conditions and it worked

   if (pageState.loading) {
      return <PageLoader />
   }

   if (pageState.error) {
      return <PageError />
   }

any idea what happen to my react code?

thanks in advance

rionalab
  • 42
  • 5

0 Answers0