What I want is for the user to type in the username and password they created on a login page. upon clicking the Sign In button, this function is triggered
const onSubmit = (event) => {
event.preventDefault()
apiClient.signIn(username, password).then((response) => {
console.log(response)
if (response === 'Logged In') {
return <Redirect to='/forum' />
}
else {
document.getElementById('error').innerHTML = ("Wrong Username or Password");
}
}).catch(error => {
console.log('Error found when creating meeting');
})
}
they would be redirected to another page where a text would welcome them in the 'comment' id
return (
<section class = "index-banner" >
<div>
/* the (username) tag is where the persons username would show up*/
<body id = "comment" >Welcome (username)</body>
</div>
</section>
)
Only problem is I don't know how to export a string into another page. I'm quite new at React so there are some problems I'm still trying to learn
What is the best way to achieve this?