Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
14.3 Tanstackin lisääminen pääsivulle | Antti/add-tanstack-library-index-page #62
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
14.3 Tanstackin lisääminen pääsivulle | Antti/add-tanstack-library-index-page #62
Changes from 4 commits
32387c6
00b7d9f
64f64b6
a955433
63607c7
3a7c033
21213f4
03c2625
b04dc77
84bf6a7
27a3a42
8ea3cb7
3ddd6ef
d3d4884
35f30b4
29a742e
a59ed04
8f33262
f01b283
becd2c3
93dc9af
dee75a4
cf575be
83b347c
396693f
14db5bd
fd55e59
697af06
3e8cbd4
92abaf9
2f3ed2d
6693c10
db8d061
d8f9cac
481bc79
43cbaae
815a0f3
7960798
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kopioin tämän funktion
Button.tsx
:n sisään. Ymmärsinkö oikein? 😄There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Itse asiassa ajattelin että olisi kopioinut tämän funktion
utils
kansion johonkin tiedostoon, ja käyttänyt sitä Button-tiedostossa. Sitä voi käyttää Buttonin ulkopuolella kuten nyt teet, mutta jos käyttäisit sitä Button-komponentissa niin sitä ei tarvitsisi käyttää joka kerta kun käyttää async-funktiota onClick-handlerissä.Eli perus-buttonissa onClick-propertyyn ei voi laittaa async-funktiota, mutta jos muuttaisi Button.tsx-tiedostoa seuraavasti niin sitten voisit poistaa
errorWrapper
funktion esim. index.tsx tiedostosta ja laittaa kaikkiin paikkoihin missä käytät Button-komponenttia async-funktion onClick handleriin.Eli kun tekee näin, niin
Button
komponenttiin voi hyvillä mielin laittaa aina async-funktion eikäerrorWrapper
komponenttia tarvitse importata joka paikassa.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oliko muuten
ComponentPropsWithoutRef<'button'>
käytön syynä mitään erityistä? Mietin että olisiko tässä voinut käyttääButtonHTMLAttributes<HTMLButtonElement>
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Olisi voinut käyttää tuotakin. Suosin tuota käyttämääni siksi, ettei tarvitse muistaa tuota
ButtonHTMLAttributes
mikä on jokaiselle html-komponentille eri. Ja sitten lisäksi se on vähän lyhyempi. Julkaisin Notion-muistiinpanoni asiasta mitä kirjasin itseäni varten, jos kiinnostaa vilkaista.