Answer the question
In order to leave comments, you need to log in
How to load API via url in React?
There is a link https://api.coinmarketcap.com/v1/ticker/?limit=10 which contains an array of cryptocurrencies with updated prices.
How to load it and pass it to state using react/redux?
Any info, links, similar examples will be helpful!
I did not deal with such a backend, please help!
Answer the question
In order to leave comments, you need to log in
Google shows it everywhere.
the concept of react redux
1. an action is created, it has an asynchronous request to api, it dispatches 3 events, the request is executed, completed, failure.
2. 3 dispatchers are created, each of which, receiving a specific event, modifies the store in a certain way. for example {isRun: false, response: [], status: true}
3. a component is created, mapped to the state on this branch, the corresponding action is thrown into the component.
4. Depending on the task, the action is called in the required part of the component. Alya at the moment of mount, from the moment of changing some props at the moment of triggering the onclick / onchenzh event of some element.
The render will do the rest for you.
Good luck.
There are examples of how this is done in the git, for any project with a react / redux stack, they googled it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question