Telegram Group & Telegram Channel
Управление типами кортежей

Предположим, у нас есть функция, которая возвращает кортеж, например, пользовательский хук:


function useBool(initialValue = false) {
const [state, setState] = React.useState(initialValue)

const handlers = React.useMemo(
() => ({
on: () => setState(true),
off: () => setState(false),
toggle: () => setState(s => !s),
reset: () => setState(initialValue),
}),
[initialValue],
)

return [state, handlers]
}

const result = useBool()



https://kyleshevlin.com/wrangling-tuple-types/

✍️ @React_lib



tg-me.com/React_lib/605
Create:
Last Update:

Управление типами кортежей

Предположим, у нас есть функция, которая возвращает кортеж, например, пользовательский хук:


function useBool(initialValue = false) {
const [state, setState] = React.useState(initialValue)

const handlers = React.useMemo(
() => ({
on: () => setState(true),
off: () => setState(false),
toggle: () => setState(s => !s),
reset: () => setState(initialValue),
}),
[initialValue],
)

return [state, handlers]
}

const result = useBool()



https://kyleshevlin.com/wrangling-tuple-types/

✍️ @React_lib

BY React


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/React_lib/605

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

If riding a bucking bronco is your idea of fun, you’re going to love what the stock market has in store. Consider this past week’s ride a preview.The week’s action didn’t look like much, if you didn’t know better. The Dow Jones Industrial Average rose 213.12 points or 0.6%, while the S&P 500 advanced 0.5%, and the Nasdaq Composite ended little changed.

How Does Telegram Make Money?

Telegram is a free app and runs on donations. According to a blog on the telegram: We believe in fast and secure messaging that is also 100% free. Pavel Durov, who shares our vision, supplied Telegram with a generous donation, so we have quite enough money for the time being. If Telegram runs out, we will introduce non-essential paid options to support the infrastructure and finance developer salaries. But making profits will never be an end-goal for Telegram.

telegram from ye


Telegram React
FROM USA