So I need to display Home.js at localhost/posts but when i click at button it displays info at the auth.js url how to link button so that if login info is correct it goes to "localhost/posts" and not render its info at base url
auth.js
const Auth = () => {
const { Userr } = useContext(Gloabaldata);
const login = async (e) => {
e.preventDefault();
signInWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
const user = userCredential.user;
})
.catch((error) => {});
};
return (
<>
{Userr ? (
<>
<Home />
</>
) : (
<>
<input
type="email"
placeholder="Email Address"
onChange={(event) => {
setregisterEmail(event.target.value);
}}
/>
<input
type="password"
placeholder="Password"
autoComplete="on"
onChange={(event) => {
setregisterPassword(event.target.value);
}}
/>
<button onClick={login} className="sign-in">
SIGN IN
</button>
<button className="switchmode">
<h3>dont have a ACCOUNT ? SIGN UP</h3>
</button>
</form>
</div>
</>
)}
</>
export default Auth;