Reputation: 119
every button in reactjs cannot clickable in firefox
<button className="btn btn-default" onClick={ this.onSignIn }>Sign In</button>
<button className="btn btn-default" ><Link to="/signup">Register</Link></button>
for onclick this is my function
onSignIn() {
//Grab state and post request to backend
const {
signInEmail,
signInPassword
} = this.state;
this.setState({
isLoading: true,
});
// POST request to backend
fetch('/api/account/signin', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: signInEmail,
password: signInPassword,
}),
}).then(res => res.json())
.then(json => {
if (json.success) {
setInStorage('the_main_app', { token: json.token });
this.setState({
signInError: json.message,
isLoading: false,
signInEmail,
signInPassword,
token: json.token,
});
} else {
this.setState({
signInError: json.message,
isLoading: false,
});
}
});
}
and for Link i just import
import { Link } from 'react-router-dom';
in another browser (ex: chrome or safari) the button works, but in firefox when i clicked the button, doesn't do anything. And I get the error:
source map error.
Upvotes: 0
Views: 527
Reputation:
Try removing link from within your button. That's what causing the problem, since your button catches the click, but doesn't know what to do with it.
Better to use your action. You should be able to do something like this...
import { push } from "react-router-redux";
export const changeUrl = location => dispatch => {
dispatch(push(location));
};
Upvotes: 0