Answer the question
In order to leave comments, you need to log in
How to change the text of several buttons at once?
https://vk.cc/auaisi
When you click on the sign up button, the send
button appears
. It is necessary that when you click on the send button, the sign up button changes the text to you are written down
. For some reason, the text of only one button changes for me.
Answer the question
In order to leave comments, you need to log in
handleClickSubmit = () => {
// this.props.handleFormSubmitted(!this.state.isSubmited) <-
// что-то такое послать в родительский компонент, и там это сохранить в стейт,
// в зависимости от этого и менять текст кнопки
this.setState({
isSubmited: !this.state.isSubmited,
});
}
The first option is a bidirectional data flow as in the first answer, but if you have 10 - 20 components you will get confused . The
easiest way is to connect any state management
Context API https://reactjs.org/docs/context.html
redux + react redux
https:/ /mobx.js.org/README.html
From the new https://recoiljs.org/
Second, according to the latest style guide, new components should be made functional using hooks, not classes
1) They fit better into React's functional approach, 2) Work better with Fiber
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question