Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
new version of context in React 16.3
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
sota ohara
March 30, 2018
3
1.8k
new version of context in React 16.3
sota ohara
March 30, 2018
Tweet
Share
More Decks by sota ohara
See All by sota ohara
Re-Architecture of ReactNative
sottar
0
280
Implement prerendering w/ puppeteer
sottar
1
310
create own CMS from scratch
sottar
2
9.1k
Let’s try to hack AST of JavaScript
sottar
1
1.8k
フロントエンドエンジニアが伝えたい最近の事情
sottar
27
18k
複数人で高速に開発するためのnpmモジュール
sottar
5
2.6k
2ヶ月半でサービスをリリースした話し
sottar
2
2.2k
Redux のディレクトリ構成を考える
sottar
2
15k
モダンなJavaScriptアプリケーションでモダンにスタイリングする方法
sottar
9
5k
Featured
See All Featured
Designing Experiences People Love
moore
144
24k
エンジニアに許された特別な時間の終わり
watany
106
230k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
From π to Pie charts
rasagy
0
120
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
63
Become a Pro
speakerdeck
PRO
31
5.8k
GraphQLとの向き合い方2022年版
quramy
50
14k
Into the Great Unknown - MozCon
thekraken
40
2.2k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
95
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
440
Transcript
new version of context in React 16.3 - We Are
JavaScripters! @17th Mercari, inc. Frontend Engineer Sota Ohara
about me Sota Ohara / sottar Mercari, inc. / Souzoh,
inc. Frontend Engineer mercari NOW, CSTool @sottar_ sottar
React v16.3 is upcoming
React v16.3 is upcoming React v16.3 has released
React v16.3 has released https://twitter.com/reactjs/status/979458172833357825
• New life-cycle methods The functions that will be deprecated
are: • componentWillMount • componentWillUpdate • componentWillReceiveProps New method is: • static getDerivedStateFromProps • StrictMode API • AsyncMode • Update React DevTools • Update Context API ….. What’s new in React v16.3
New context API
• Typically, data in a React application is passed top-
down (parent to child) via props. • So, we also need to pass the related entire site values each layer components motivation it’s too painful !!
• The value set in the context can be acquired
from any child component. • New component types: Provider and Consumer. • Refer to the ancestor as the provider and the child as the consumer • Providers and consumers come in pairs New context API
Basic Sample
* A provider-consumer pair is created using * requires a
default value React.createContext() React.createContext()
* The provider accepts a context value as a prop
* In the typical scenario, context value has in state. and updated by calling setState. Provider
* The consumer uses a render prop API * In
the typical scenario, context value has in state and updated by calling setState. Consumer
FYI. What’s new in React 16.3(0-alpha) https://medium.com/@baphemot/whats-new-in-react-16-3-d2c9b7b6193b
We are hiring !!