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
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
130
ENTREGANDO UMA EXPERIÊNCIA MELHOR COM SWR
tailomateus
0
120
Other Decks in Programming
See All in Programming
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
The Rails Doctrine Decade
koic
2
440
Webの地図
yosuke_furukawa
PRO
6
5k
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
3.1k
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
320
スマートフォンでモールス信号を送受信する 〜スマートフォンのLEDとカメラで作る光通信の設計と実装〜
atsuki_seo
0
220
Androidだけじゃない、DroidKaigiで広がった私の技術スタック
akkeylab
0
110
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
460
AgentCore CLI で進化した AWS での AI エージェントの作り方 : 必要な機能を必要な時に
icoxfog417
PRO
4
400
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
450
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
250
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
150
Featured
See All Featured
Code Review Best Practice
trishagee
74
20k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Paper Plane
katiecoart
PRO
4
53k
From π to Pie charts
rasagy
1
380
Skip the Path - Find Your Career Trail
mkilby
1
240
Making Projects Easy
brettharned
120
6.8k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
330
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
600
The Cult of Friendly URLs
andyhume
79
7k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
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