Target notistack child

30 Views Asked by At

I’m trying to add a "dismiss all snackbars" button that is a snackbars himself. I added an if condition that checks if there are more than two snackbars, then adds the button. Now I need the button to be at the top of all snackbars all the time.

I accomplished it this way:

const insertStyle = document.getElementById('dismissAllSnackbars')?.parentElement?.parentElement?.parentElement?.parentElement?.setAttribute('style', 'order: 1');

Does anyone know a better way?

0

There are 0 best solutions below