S
S
Soft_touch_plastic2021-05-27 13:46:15
JavaScript
Soft_touch_plastic, 2021-05-27 13:46:15

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

3 answer(s)
D
Dmitry, 2019-01-11
@qfrontend

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>

D
dev null, 2019-01-11
@curious-101

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 }
 />

M
MikUrrey, 2021-05-27
@MikUrrey

> Is there a problem with cors policy?
Look in Chrome Dev Tools / Network, there will be a definite answer.
> And you can get around this somehow
. If this is CORS, then only by creating a "mirror" on your own server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question