-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Basic] Hooks: useState type #403
Labels
BASIC
Basic Cheatsheet
Comments
thanks @priscilaandreani, i've added this comment now! https://github.com/typescript-cheatsheets/react/blob/main/docs/basic/getting-started/hooks.md#usestate happy to take more suggestions from you :) |
stepanenko
added a commit
to stepanenko/react-ts-best-practices
that referenced
this issue
May 3, 2021
* Updated README on 2021-04-02T14:21:23.928Z * Fix missing parenthesis in troubleshooting types code example (typescript-cheatsheets#399) Co-authored-by: swyx <shawnthe1@gmail.com> * format * minor improvements to "adding non-standard attributes" (typescript-cheatsheets#400) * Added event types and their descriptions (typescript-cheatsheets#402) * Added form types and their descriptions I was looking for a complete list of form types and couldn't find any anywhere. I went through the source code and extracted these with adding some description to them, either using MDN's description or some other website explanation. * Apply suggestions from code review Co-authored-by: swyx <shawnthe1@gmail.com> * fix: Remove incorrect usage of "widening" (typescript-cheatsheets#405) Using an intersection type here is actually narrowing the type, but the intent here seems to be to introduce type assertions, not talk about the difference between wider and narrower types. * add type assertion for useState thanks @priscilaandreani closes typescript-cheatsheets#403 * format * Fixed typo (typescript-cheatsheets#406) Fixed an issue where a paragraph described three different options as two. * Add rollpkg as an option for creating libraries (typescript-cheatsheets#407) * useLocalStorage Type detection bug (typescript-cheatsheets#409) in my vs code it detects that the type of soredValue is (T | (value: T | ((val: T) => T)) => void) but it must be just (T) so it throws error with this change it solved. * Updated README on 2021-04-25T20:13:23.562Z Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Denis LE <ledenis@users.noreply.github.com> Co-authored-by: swyx <shawnthe1@gmail.com> Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com> Co-authored-by: Lars <32460418+advename@users.noreply.github.com> Co-authored-by: Gerrit Birkeland <gerrit@gerritbirkeland.com> Co-authored-by: Christopher Kumm <40023417+ChrisCrossCrash@users.noreply.github.com> Co-authored-by: Rafael Pedicini <rafael@rafgraph.dev> Co-authored-by: Mandy YP <63463742+mmdHasan-yazdanPanah@users.noreply.github.com>
stepanenko
added a commit
to stepanenko/react-ts-best-practices
that referenced
this issue
May 9, 2021
* Updated README on 2021-04-02T14:21:23.928Z * Fix missing parenthesis in troubleshooting types code example (typescript-cheatsheets#399) Co-authored-by: swyx <shawnthe1@gmail.com> * format * minor improvements to "adding non-standard attributes" (typescript-cheatsheets#400) * Added event types and their descriptions (typescript-cheatsheets#402) * Added form types and their descriptions I was looking for a complete list of form types and couldn't find any anywhere. I went through the source code and extracted these with adding some description to them, either using MDN's description or some other website explanation. * Apply suggestions from code review Co-authored-by: swyx <shawnthe1@gmail.com> * fix: Remove incorrect usage of "widening" (typescript-cheatsheets#405) Using an intersection type here is actually narrowing the type, but the intent here seems to be to introduce type assertions, not talk about the difference between wider and narrower types. * add type assertion for useState thanks @priscilaandreani closes typescript-cheatsheets#403 * format * Fixed typo (typescript-cheatsheets#406) Fixed an issue where a paragraph described three different options as two. * Add rollpkg as an option for creating libraries (typescript-cheatsheets#407) * useLocalStorage Type detection bug (typescript-cheatsheets#409) in my vs code it detects that the type of soredValue is (T | (value: T | ((val: T) => T)) => void) but it must be just (T) so it throws error with this change it solved. * Updated README on 2021-04-25T20:13:23.562Z * Clarify useRef hook usages (typescript-cheatsheets#412) Co-authored-by: swyx <shawnthe1@gmail.com> * Update index.md * Update from-flow.md * docs: throw when ref.current is null (typescript-cheatsheets#413) * Update types.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Denis LE <ledenis@users.noreply.github.com> Co-authored-by: swyx <shawnthe1@gmail.com> Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com> Co-authored-by: Lars <32460418+advename@users.noreply.github.com> Co-authored-by: Gerrit Birkeland <gerrit@gerritbirkeland.com> Co-authored-by: Christopher Kumm <40023417+ChrisCrossCrash@users.noreply.github.com> Co-authored-by: Rafael Pedicini <rafael@rafgraph.dev> Co-authored-by: Mandy YP <63463742+mmdHasan-yazdanPanah@users.noreply.github.com> Co-authored-by: Thien Do <hello@thien.do> Co-authored-by: Christina Grannas <christina.grannas@gmail.com>
chef1119
pushed a commit
to chef1119/chef-typescript
that referenced
this issue
Oct 20, 2021
bernssolg
added a commit
to bernssolg/My-React-Sample
that referenced
this issue
Feb 28, 2022
erinodev
added a commit
to erinodev/My-React-project
that referenced
this issue
Feb 28, 2022
petardev101
added a commit
to petardev101/react
that referenced
this issue
Jun 4, 2022
supercrytoking
added a commit
to supercrytoking/react
that referenced
this issue
Jul 14, 2022
kevindavies8
added a commit
to kevindavies8/react-full-stack-developer
that referenced
this issue
Aug 24, 2022
johnfrench3
pushed a commit
to johnfrench3/react-Fronted-developer
that referenced
this issue
Sep 7, 2022
ericbrown2716
added a commit
to ericbrown2716/react-stack-build-website
that referenced
this issue
Sep 29, 2022
peterjohnson4987
added a commit
to peterjohnson4987/full-stack-developer-react
that referenced
this issue
Oct 3, 2022
renawolford6
pushed a commit
to renawolford6/react-husky-website
that referenced
this issue
Oct 6, 2022
Yoshidayoshi23
added a commit
to Yoshidayoshi23/react
that referenced
this issue
Oct 20, 2022
renawolford6
added a commit
to renawolford6/react-dev-build-doc-
that referenced
this issue
Nov 10, 2022
coopfeathy
added a commit
to coopfeathy/cheatsheet
that referenced
this issue
Dec 4, 2022
dreamcoder75
added a commit
to dreamcoder75/react-sample
that referenced
this issue
Jan 15, 2023
holyblock
pushed a commit
to holyblock/chart
that referenced
this issue
Feb 27, 2023
AIDevMonster
added a commit
to AIDevMonster/Awesome-React
that referenced
this issue
Jun 21, 2023
whiteghostDev
added a commit
to whiteghostDev/Awesome-React
that referenced
this issue
Aug 6, 2023
cedev935
added a commit
to cedev935/React-TypeScript
that referenced
this issue
Sep 11, 2023
aleksandaralek
added a commit
to aleksandaralek/typescript-react-cheatsheet
that referenced
this issue
Oct 24, 2023
xbucks
pushed a commit
to xbucks/react-cheatsheets
that referenced
this issue
Oct 24, 2023
KonohaBrain125
pushed a commit
to KonohaBrain125/React-Typescript
that referenced
this issue
Oct 26, 2023
TOP-10-DEV
added a commit
to TOP-10-DEV/typescript-cheatsheets-react
that referenced
this issue
Dec 8, 2023
secretsuperstar1109
added a commit
to secretsuperstar1109/react-typescript-cheatsheets
that referenced
this issue
Dec 9, 2023
champion119
added a commit
to champion119/react
that referenced
this issue
Jan 5, 2024
dragon360-dev
added a commit
to dragon360-dev/react
that referenced
this issue
Mar 13, 2024
EugeneYoona
added a commit
to EugeneYoona/React_full_src
that referenced
this issue
Apr 10, 2024
fairskyDev0201
added a commit
to fairskyDev0201/typescript-cheatsheet
that referenced
this issue
Apr 17, 2024
solutionGuru0129
added a commit
to solutionGuru0129/react
that referenced
this issue
May 27, 2024
alisenola
added a commit
to alisenola/react-cheatsheets
that referenced
this issue
May 29, 2024
marceloaguilera94
pushed a commit
to marceloaguilera94/react
that referenced
this issue
Jun 5, 2024
Linda423
added a commit
to Linda423/React
that referenced
this issue
Jul 31, 2024
genie4viz
pushed a commit
to genie4viz/react
that referenced
this issue
Sep 2, 2024
miracle-soft-expert
added a commit
to miracle-soft-expert/React-TypeScript
that referenced
this issue
Oct 15, 2024
chivalrousdev
added a commit
to chivalrousdev/React
that referenced
this issue
Nov 14, 2024
super-dev03
added a commit
to super-dev03/react-test
that referenced
this issue
Dec 25, 2024
Mani2044
added a commit
to Mani2044/react
that referenced
this issue
Feb 6, 2025
sunstrike-spec
added a commit
to sunstrike-spec/react
that referenced
this issue
Feb 23, 2025
darkhorse374
added a commit
to darkhorse374/React
that referenced
this issue
Feb 28, 2025
Misha0421
added a commit
to Misha0421/React-Project
that referenced
this issue
Mar 4, 2025
luckyman0026
added a commit
to luckyman0026/react
that referenced
this issue
Mar 5, 2025
buddy0323
added a commit
to buddy0323/react
that referenced
this issue
Mar 11, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What cheatsheet is this about? (if applicable)
Basic cheatsheet
What's your issue or idea?
Idea
instead of:
you can use:
(of course if IUser is an object)
its always great to start the state using its initial format
The text was updated successfully, but these errors were encountered: