Hello Everyone,
Just Started learning about Moralis, i just wanted to try doing a doing a conditions if isAuthenticated show the text but it doesn’t, i had take the moralis docs example to start but didn’t work anyway :
import React, { useEffect } from "react";
import { useMoralis } from "react-moralis";
// import Navigations from "./routing/Navigations";
import "./styles/styles.scss";
const App = () => {
const { authenticate, isAuthenticated, user, Moralis } = useMoralis();
if (!isAuthenticated) {
return (
<div>
<button onClick={() => authenticate()}>Authenticate</button>
</div>
);
}
return (
<div>
<h1>Welcome {user.get("username")}</h1>
</div>
);
// return <Navigations />;
};
export default App;
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import { MoralisProvider } from "react-moralis";
ReactDOM.render(
<React.StrictMode>
<MoralisProvider
appId="xxxxx"
serverUrl="xxxx"
>
<App />
</MoralisProvider>
</React.StrictMode>,
document.getElementById("root")
);
of course i put the key and the serverUrl in my app
when i click on authenticate it goes to the metamask window, ask me to sign when i sign the window go back to my component but doesn’t display text as if i was authenticate
no error message and if i console log isAuthenticated after is the value is False.
Thanks for your future help !