You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
why: autocomplete for imports is easier. more tidy and easy to refactor. better documented.
refactor react components to typescript
change file extension to .tsx
use React.FC type for components
(this below is a personal preference, but i think it's desirable to avoid duplication) don't decompose props in the arguments of the component.
instead of:
constAnimals: React.FC<{dog: string,cat: string,mouse: string}>=({dog, cat, mouse})=>{return(<div>
i hate my dog {dog}, my cat {cat} and my mouse {mouse}</div>)}
do
constAnimals: React.FC<{dog: string,cat: string,mouse: string}>=(p)=>{return(<div>
i hate my dog {p.dog}, my cat {p.cat} and my mouse {p.mouse}</div>)}
you get autocomplete with the props, and then you don't need to pass duplicate stuff.
The text was updated successfully, but these errors were encountered:
@greenlucid i've made several advances with this one. I think that i'm missing one or two files that are still in JS, but i want to share w/ you to check if its in the proper direction
no big export default
to
why: autocomplete for imports is easier. more tidy and easy to refactor. better documented.
refactor react components to typescript
change file extension to
.tsx
use
React.FC
type for components(this below is a personal preference, but i think it's desirable to avoid duplication) don't decompose props in the arguments of the component.
instead of:
do
you get autocomplete with the props, and then you don't need to pass duplicate stuff.
The text was updated successfully, but these errors were encountered: