Answer the question
In order to leave comments, you need to log in
Is the problem in cors policy or not?
Hello, you need to use the api of one site, which, depending on the data in GET, returns a picture. The catch is that everything works well on their site, but if you embed it in ours, or throw a link to a social network where there is a preview of the link, then the default picture no data is thrown, although if the same link is opened simply in the browser, the correct image will be displayed. Is there a problem in cors policy? And is there any way to bypass it?
Answer the question
In order to leave comments, you need to log in
Because the constructor is called only when the component is created, not when it is redrawn. You don’t need to translate props into state in message, what’s the point if it still comes from the parent and changes in another component?
When rendering, just write<p className="message__text">{this.props.text}</p>
Dimitri is correct. I will only add that if for some reason you need to keep text in the state of the Message component, then in order for it to be re-rendered after changing the props, change the state in componentWillRecieveProps or you can add a key to this component:
<Message
key={text}
text={ text }
/>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question