Caio Flores e João Marins
React Hooks
Caio Flores
CTO at sigalei
@caioflores @caiopflores
Topics
● Motivation
● What are hooks?
● How to use?
● Examples
● Now what?
● Opportunities
● Links
Motivation
Motivation
● Reuse code
● Complex components are hard to understand
● Classes are confusing
Motivation
● 09/2018 - Hooks at
Facebook
● 25/11/2018 - RFC
(react 16.7.0-alpha.0)
● React 16.7: Hooks
(~Q1 2019)
https://github.com/reactjs/rfcs/pull/68/
What are hooks?
“Hooks are functions that let you 'hook into'
React state and lifecycle features from
function components.”
What are hooks?
How to use?
How to use?
How to use?
When/How not to use?
How to use?
● Don't call hooks inside loops, conditionals or nested
functions
● Don't call hooks from regular JS functions
How to use?
Examples!
Examples
● https://github.com/caioflores/react-hook-examples
Now what?
Now what?
● Don't rewrite everything, adopt gradually
● No breaking changes
● Hype?
● Opportunities!
Now what?
Links
● Hooks: https://reactjs.org/hooks
● Hooks API: https://reactjs.org/docs/hooks-reference.html
● Hooks RFC: https://github.com/reactjs/rfcs/pull/68
● Example: https://github.com/caioflores/react-hook-
examples
● React Roadmap:
https://reactjs.org/blog/2018/11/27/react-16-
roadmap.html
● React RFCs: https://github.com/reactjs/rfcs
Caio Flores
CTO at sigalei
@caioflores @caiopflores
João Marins
Full Stack Developer at Entria
@jgcmarins @jgcmarins
Thank you!

More Related Content

PPTX
React Hooks
PDF
Git best practices 2016
PDF
CraftCamp for Students - Introduction to JHipster
PPTX
React Native
PDF
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
PDF
PUG Romagna - Pipeline + Deployer PHP
PDF
Get started with AAR
PPTX
JHipster presentation by Gaetan Bloch
React Hooks
Git best practices 2016
CraftCamp for Students - Introduction to JHipster
React Native
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
PUG Romagna - Pipeline + Deployer PHP
Get started with AAR
JHipster presentation by Gaetan Bloch

What's hot (8)

PDF
Git and Github workshop
PDF
"The Story of Declarative React at Grammarly: From two-way data binding with ...
PPTX
PDF
Getting Started with GitHub
PDF
Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo...
PPTX
Creating books app with react native
PDF
PPTX
12 Best Android Libraries to use in 2021
Git and Github workshop
"The Story of Declarative React at Grammarly: From two-way data binding with ...
Getting Started with GitHub
Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo...
Creating books app with react native
12 Best Android Libraries to use in 2021
Ad

Similar to React Hooks (20)

PDF
React hooks beyond hype
PDF
React.js hooks feb 23rd meetup
PDF
Introduction to React Hooks
PDF
Basics of React Hooks.pptx.pdf
PDF
Hello, React Hooks!
PPTX
React-JS.pptx
PDF
Importance of Hook in Recat Js.pdf
PPTX
React hooks
PDF
React hooks Episode #1: An introduction.
PDF
Understanding React hooks | Walkingtree Technologies
PPTX
Understanding react hooks
PPTX
Hook me UP ( React Hooks Introduction)
PDF
React – Let’s “Hook” up
PDF
Understanding react hooks
PDF
How do we use hooks
PDF
React Hooks: Enhancing Functional Components with useState, useEffect, and Cu...
PPTX
React Hooks A 2019 Feature That Changed the Game Forever.pptx
PPTX
Green Custard Friday Talk 21: React Hooks
PPTX
TRAINING pptt efwoiefo weoifjoiewjfoifjow.pptx
PPTX
React Hooks
React hooks beyond hype
React.js hooks feb 23rd meetup
Introduction to React Hooks
Basics of React Hooks.pptx.pdf
Hello, React Hooks!
React-JS.pptx
Importance of Hook in Recat Js.pdf
React hooks
React hooks Episode #1: An introduction.
Understanding React hooks | Walkingtree Technologies
Understanding react hooks
Hook me UP ( React Hooks Introduction)
React – Let’s “Hook” up
Understanding react hooks
How do we use hooks
React Hooks: Enhancing Functional Components with useState, useEffect, and Cu...
React Hooks A 2019 Feature That Changed the Game Forever.pptx
Green Custard Friday Talk 21: React Hooks
TRAINING pptt efwoiefo weoifjoiewjfoifjow.pptx
React Hooks
Ad

Recently uploaded (20)

PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PDF
AI Guide for Business Growth - Arna Softech
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PDF
Website Design Services for Small Businesses.pdf
PPTX
Tech Workshop Escape Room Tech Workshop
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PDF
Visual explanation of Dijkstra's Algorithm using Python
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PPTX
Computer Software and OS of computer science of grade 11.pptx
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PDF
iTop VPN Crack Latest Version Full Key 2025
PPTX
Introduction to Windows Operating System
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PPTX
GSA Content Generator Crack (2025 Latest)
Wondershare Recoverit Full Crack New Version (Latest 2025)
AI Guide for Business Growth - Arna Softech
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
How Tridens DevSecOps Ensures Compliance, Security, and Agility
Oracle Fusion HCM Cloud Demo for Beginners
Website Design Services for Small Businesses.pdf
Tech Workshop Escape Room Tech Workshop
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Visual explanation of Dijkstra's Algorithm using Python
Salesforce Agentforce AI Implementation.pdf
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
Computer Software and OS of computer science of grade 11.pptx
How to Use SharePoint as an ISO-Compliant Document Management System
iTop VPN Crack Latest Version Full Key 2025
Introduction to Windows Operating System
Weekly report ppt - harsh dattuprasad patel.pptx
GSA Content Generator Crack (2025 Latest)

React Hooks

Editor's Notes

  • #6: 1 - HOC tentam resolver o reuso de "stateful logic" entre componentes 2 - Componentes complexos tem muita lógica nos lifecycles, isso deixa difícil de entender e testar. Hooks permitem que você consiga separar a lógica do seu componente em funções menores, tornando menos complexo e mais fáceis de testar e reusar. 3 - Classes são confusas, é difícil entender como usar o this, dar bind nos métodos e elas não minificam bem.
  • #7: Não devem encontrar muitos bugs já RFC = Request for comments
  • #9: Basicamente é uma forma de vc conseguir manipular o estado e o lifecyle de componentes funcionais
  • #12: useImperativeMethods customizes the instance value that is exposed to parent components when using ref
  • #13: 1) Ele usa a ordem das chamadas para organizar vários useState e useEffect, por isso a primeira regra. 2) Para garantir que toda a lógica de estado de um componente esteja visível no seu código.
  • #14: 1) Ele usa a ordem das chamadas para organizar vários useState e useEffect, por isso a primeira regra. 2) Para garantir que toda a lógica de estado de um componente esteja visível no seu código.
  • #15: 1) Ele usa a ordem das chamadas para organizar vários useState e useEffect, por isso a primeira regra. 2) Para garantir que toda a lógica de estado de um componente esteja visível no seu código.
  • #17: Mostrar loading com useEffect que tem o mesmo efeito de um shouldUpdate, que só atualiza quando a prop realmente muda Mostrar o Input, enfatizando a criação de um hook próprio, e como podemos reaproveitar o código e deixar a estrutura do componente mais simples
  • #19: 1) O suporte para classes não vai acabar, teste hooks em códigos novos
  • #20: 1) O suporte para classes não vai acabar, teste hooks em códigos novos