K
K
Korifa2019-05-25 19:39:15
JavaScript
Korifa, 2019-05-25 19:39:15

How to get data via api in react while taking into account cookies?

I want to make a test task, but I can’t understand:
1) where in react should I send an api request? I read on Habré that you can do this in componentDidMount ()
and if a person comes in for the second time and I want to save the information in cookies, and not send the request again, how can I do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
McBernar, 2019-05-25
@Korifa

Obviously - check cookies before sending a request to the API.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question