Materialize Responsive Navbar with React

Hi, i’m using materalize with my project and i want my navbar to be responsive while i know how it works in html file (scroll down to the bottom to mobile collapse button)

This approach doesn’t seem to work with React. Any other way to accomplish that?

What is your code so far? what have you tried in your project? the guide you gave us seems to explain how it works into HTML but, what does it have to do with react? react is just a libary right?/

After endless time that i looked for it online, i finally managed to find the solution

For anyone else struggling with it, put it in your navbar component

omponentDidMount() {
const M = window.M;
document.addEventListener(‘DOMContentLoaded’, function () {
var elems = document.querySelectorAll(’.sidenav’);
var instances = M.Sidenav.init(elems, {});