Just learned how to create custom hooks in ReactJS! Also, discovered the differences between class and functional components. #ReactJS#CustomHooks#FunctionalComponent
I feel this calls for a post on my blog ;) but until then
- Readability: check the interface definition of React's FunctionalComponent for example
- Compiler errors: Try Elm compiler and see what I mean
- Bad ROI: Simply put I don't feel the value (yet)
- OS: Which a company owns
#Day72 of #100DaysOfCode
- Learned about Hooks system in react 😃
#reactjs#javascript
HOOKS SYSTEM IN REACT
- useState ->function that lets you use state in a functional component
-useEffect ->function that lets you use something like lifecycle methods in a functionalComponent
this PR (github.com/preactjs/preact/p…) seems to suggest that preact originally used `FunctionalComponent` as the type name, while react used the name `FunctionComponent`; both names are provided for compatibility but they are identical
gist.github.com/forki/a32566… here I'm wrapping a websocket in a FunctionalComponent. It retries to connect whenever the socket is lost and automatically closes the socket when the component is unmounted. You can use onMessage to dispatch into outer update loop
hemos estado mejorando nuestra aplicación de #reactjs y entre los refactors y librerías, han salido cosas interesantes que usamos,
pasamos de #ClassComponent a #FunctionalComponent y algunos de ellos son de tipo memo, muchos hooks de hecho y funciones declarativas pequeñas.