Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
React components - Melhores práticas
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Tailo Mateus Gonsalves
May 28, 2021
Programming
34
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
React components - Melhores práticas
Tailo Mateus Gonsalves
May 28, 2021
More Decks by Tailo Mateus Gonsalves
See All by Tailo Mateus Gonsalves
BATE PAPO SOBRE A VIDA, A CARREIRA E TUDO MAIS!
tailomateus
0
24
Chapter Lead
tailomateus
0
45
Arquitetura_Front-end.pdf
tailomateus
0
120
ENTREGANDO UMA EXPERIÊNCIA MELHOR COM SWR
tailomateus
0
120
Other Decks in Programming
See All in Programming
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
890
RSSとCodexを使ってX投稿自動化してみた
ochtum
0
110
Intent as Code
shoppingjaws
4
620
業務時間外もAIに働いてもらう話
colorful12
3
10k
PyO3 で既存 Python 評価器を Rust core 化する ー wasm-bindgen でブラウザにも配るための設計
kdash
1
560
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
[DroidKaigi 2026] Bring your own phones to Gradle Managed Devices
f2lk
0
110
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
6
2.6k
不幸な GC
chencmd
0
890
20260828_品質と開発生産性を両立させる、AI時代のE2Eテストの考え方
magicpod
0
170
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
7
2.6k
Featured
See All Featured
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
510
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
270
How to make the Groovebox
asonas
2
2.4k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
330
GitHub's CSS Performance
jonrohan
1033
470k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
840
Code Reviewing Like a Champion
maltzj
528
40k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
340
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Transcript
React components - Melhores práticas
Podemos quebrar interfaces inteiras em pequenos blocos
• Deve fazer algo específico (sem requests ou regras de
negócio) • Separação de constantes e helpers • Fácil de usar • Fácil para entender • Documentação atualizada Como deveria ser?
const Component = ({title, cards}) => { return <div> <h1>{title}</h1>
{ cards.map(({title: cardTitle, subtitle, image}) => ({ <div> <h3>{cardTitle}</h3> <h5>{subtitle}</h5> <img src={image} /> </div> })) } </div> } const Component = ({title, cards}) => { return <div> <h1>{title}</h1> <CardsList cards={cards} /> </div> } O componente pai não precisa saber sobre os detalhes
Todos os arquivos relacionados ao componente devem estar em uma
única pasta: components Button Button.tsx Button.stories.tsx Button.test.tsx styles.ts
None
Renderização de todos os componentes quando alguma props é alterada
Com memo, não vai renderizar o componente e reutilizar o último resultado renderizado. Problema Solução
None
None
render( <Container> <Button>Normal Button</Button> </Container> ); export const Button =
styled.button` background: transparent; border-radius: 3px; color: palevioletred; `; Componentes de estilo
We’re not designing pages, we’re designing systems of components —
Stephen Hay
None