Search code examples
javascriptreactjsreduxmaterial-uinotistack

Shows random number enqueuesnackbar (notistack) in react js


I am using notistack package. need to show snackbar on the screen. while calling the Snack component which is using enquesnackbar it shows the snackbar but also show the random number on the screen.

I want to remove that random number from screen. it should not visible on the screen.

code sandbox demo

https://codesandbox.io/s/naughty-microservice-ocoig2?file=/src/index.js


Solution

  • I got the temporary solution for that.

    I have added display non in the component. In this case random number will be there but it won't be visible on screen.

      <div style={{display: "none"}}>
        {messageList.map(({ message }) => (
          <Snack message={message} />
        ))}
        </div>
    

    if anyone found any other solution feel free to post here.