export default React.memo(Header);
const { state, dispatch } = useStore();
const searchInputs = state.inputs.search;
const { getState, dispatch } = useStore();
const searchInputs = getState().inputs.search;
const { getState, dispatch } = useStore();
const searchInputs = searchSelector(getState());
class Form extends React.Component {
state = {
name: '',
lastName: '',
errors: {},
};
handleChange = e => { /* ... */ };
handleSubmit = e => { /* ... */ };
render() {
const { name, lastName } = this.state;
return (
<div>
<div>
<input name="name" value={name} onChange={this.handleChange} />
{errors.name && <div>{errors.name}</div>}
</div>
<div>
<input name="lastName" value={lastName} onChange={this.handleChange} />
{errors.lastName && <div>{errors.lastName}</div>}
</div>
<button onClick={this.handleSubmit}>Submit</button>
<div/>
);
};
}
Собирать модули.