I have the code below. It redirects to /home and passes a username variable. However, in the address bar, it shows http://localhost:3000/home?username=bobmarley. How can I pass variables using next.js cleanly?
import { withRouter } from 'next/router'
loginUser(this.state.user)
.then(response => {
var username = response['username'];
if (username) {
this.props.router.push({
pathname: '/home',
query: { username: username }
});
}
});