I am novice on react and I try to create a new website using react. and I have a problem with making button to switch to an other page. this is my code
import React from 'react';
export default class Connexion extends React.Component {
goToApp = event => {
event.preventDefault();
// On récupère le pseudo
const pseudo = this.boxInput.value;
// On change d'url
this.context.router.transitionTo(`/box/${pseudo}`);
};
render() {
return (
<div className="connexionBox">
<form className="connexion" onSubmit={(e) => this.goToApp(e)}>
<h1>Connexion</h1>
<input type="text" placeholder="Nom" pattern="[A-Za-z-]{1,}" required ref={(input) => {
this.boxInput = input
}}/>
<button type="submit">GO</button>
<p>Pas de caractères spéciaux.</p>
</form>
</div>
)
}
static contextTypes = {
router: React.PropTypes.object
};}
and the erreur message is _this.context.router.transitionTo is not a function
thanks for your time
victor
PS: I do not use redux or anything like it.