Bonjour CCM.
Lors de la compilation de mon application de bureau sous React-js j'obtient l'erreur suivante :
- A component is changing a controlled input of type email to be uncontrolled [...]
internet et les nombreux topic déja existent pour cette erreur semble tous indiquer la méme solution que j'ai déja appliqué a mon code sans que cela ne resolve mon probléme .
voici donc le code en question :
constructor(props) {
super(props);
this.state = {
logged: false,
email: '',
email02: '',
pwd: '',
pwd02: '',
lastname: '',
license: '',
token: ''
}
}
onFieldChange(fieldName) {
return function (event) {
this.setState({[fieldName]: event.target.value});
}
}
render() {
return (
<div className="App">
<Container fluid={true} className="center">
<Row>
<Col className="master">
<img src={logo} alt="UZ logo" className="picture slave" />
</Col>
</Row><Row>
<Col className="master">
<img src={brand} alt="UZ brand" className="picture brand slave" />
</Col>
</Row>
<form onSubmit={() => this.handleSubmit()}>
<Row className="justify-content-md-center">
<Col md={6}>
<input type="email" value={this.state.email} onChange={this.onFieldChange('email').bind(this)} placeholder="Email" required />
</Col>
<Col md={6}>
<input type="email" value={this.state.email02} onChange={this.onFieldChange('email02').bind(this)} placeholder="Same Email" required />
</Col>
</Row><Row>
<Col sm={6}>
<input type="password" value={this.state.pwd} onChange={this.onFieldChange('pwd').bind(this)} placeholder="Password" required />
</Col>
<Col sm={6}>
<input type="password" value={this.state.pwd02} onChange={this.onFieldChange('pwd02').bind(this)} placeholder="Same Password" required />
</Col>
</Row><Row>
<Col sm={6}>
<input type="text" value={this.state.lastname} onChange={this.onFieldChange('lastname').bind(this)} placeholder="Last name" required />
</Col>
<Col sm={6}>
<input type="text" value={this.state.license} onChange={(license) => this.setLicense(license.target.value)} placeholder="License"/>
</Col>
</Row><Row>
<Col><button type="submit">Sign-up</button></Col>
</Row><Row>
<Col><Link to="/SignIn" className="link">Already one of us? </Link></Col>
</Row>
</form>
</Container>
</div>
);
}
si cette partie de code n'est pas suffisante n'hesitez pas a demander plus .
merci.
Afficher la suite