class UserForm extends React.Component{
constructor(props){
super(props);
this.state = {
...
};
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleChange(e){
...
}
handleSubmit(e){
...
}
}
class UserForm extends React.Component{
state = {
...
};
handleChange = e => {
...
};
handleSubmit = e => {
...
};
}
const { login, password } = this.state;
const login = this.state.login;
const password = this.state.password;
<TextField
hintText="Введите пароль"
type="password"
name="password"
value={this.state.password}
onChange={this.handleChange}
/>
render() {
const { login, password } = this.state;
return (
...
<TextField
hintText="Введите пароль"
type="password"
name="password"
value={password}
onChange={this.handleChange}
/>
...
)
}
state = { ...prevState, ...newState };
state = { ...{ login: 'login', password: '' }, ...{ password: 'password' } };
// result => state = { login: 'login', password: 'password' }
handleChange = e => {
const { name, value } = e.target;
this.setState(prevState => ({
...prevState,
[name]: value,
}));
};
app.use(express.static(__dirname + '/public/'));
1. Очень востребован.
2. Работа стоит дороже.
3. Рынок растет.
4. Работа в серьезном фронтенде гораздо интересней, колупания в шаблонах и плагинах CMS.