/
githubmirror
/
redux
Обзор
Документация
Войти
/
githubmirror
/
redux
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/universal/common/api/counter.js
11 строк
437 B
Tim Dorr
Format the examples
20 мар 2024, 19:52
Не верифицирован
20 мар 2024, 19:52
3085048
Код
Авторство
О чём код?
const getRandomInt = (min, max) => Math.floor(Math.random() * (max - min)) + min export const fetchCounter = callback => { // Rather than immediately returning, we delay our code with a timeout to simulate asynchronous behavior setTimeout(() => { callback(getRandomInt(1, 100)) }, 500) // In the case of a real world API call, you'll normally run into a Promise like this: // API.getUser().then(user => callback(user)) }