Moralis SDK not working with Tailwindcss

Hi! I’m using react js with tailwindcss and I have a basic navbar imported inside App.js, however once I’m using the useMoralis hook, the entire component view disappears. This is what I have so far:

`import Navbar from './Navbar/Navbar';
import {useMoralis} from 'react-moralis'
function App() {

  const [authenticated, isAuthenticated] = useMoralis()
  return (
    <div >
    <Navbar/>
    </div>
  );
}

export default App;`

The Navbar component is just a simple example from the tailwindcss official website. Without the hook, the navbar appears and I can’t figure out what the problem might be.Has someone else had a similar problem and knows how to fix it? Any help would be appreciated!

Does your browser console show any errors?

You need to destructure useMoralis like:

const { authenticate, isAuthenticated } = useMoralis();

Not with square brackets e.g. as you would do for the useState hook.

@alex Thank you so much for your response. I can’t believe I missed that! It works perfectly now!

1 Like