Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Probably something like this .. too little data in the question)
class SomeComponent extends Component {
static propTypes = {
someFunction: PropTypes.func
}
state = {
inputValue: transferTemplateType.none,
}
handleChangeTextInput = (event) => {
this.setState({ [event.target.name]: event.target.value });
}
sendValue = () => {
this.props.someFunction(this.state.inputValue);
}
render() {
return (
<div>
<input onChange={this.handleChangeTextInput} value={this.state.inputValue} />
<button onclick={this.sendValue}>Передать значение</button>
</div >
);
}
}
const mapDispatchToProps = (dispatch) => ({
someFunction: (inputValue) => dispatch(someFunction(inputValue))
});
export default connect(null, mapDispatchToProps)(SomeComponent);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question