Open in app
Dominic Tobias
91 Followers
About

Sign in

91 Followers
About
Open in app
Dominic Tobias

Dominic Tobias

Feb 9, 2018·1 min read

Thanks, yeah that works for when the class is constructed, but not if you want to ensure the state is like that across multiple mounts. So yeah, seems like getDerivedStateFromProps is the way forward for that use case.

Dominic Tobias

I make UIs and such. Using JS mostly but I like to dabble.

You should already be doing that in state initialization, so either state = {} or in constructor.
4
1

Bartosz Szczeciński

More from Dominic Tobias

I make UIs and such. Using JS mostly but I like to dabble.

More From Medium

The Fate Of Elon Musk’s Assistant Is A Cautionary Tale For Negotiating Salary

Nick Wolny in Entrepreneur's Handbook

The Sexiest Job of the 21st Century Isn’t “Sexy” Anymore

Nishi Kashyap in ILLUMINATION

The Exact Steps I Followed to Make $1,500+ of Passive Income Every Month

Julia Horvath in Entrepreneur's Handbook

Why Is The Age of Consent in Japan Only 13-Year-Old?

Isaiah McCall in History of Yesterday

5 Things White People Keep Getting Totally Wrong About Racism

Jeremy Helligar in An Injustice!

Google Director Of Engineering: This is how fast the world will change in ten years

Michael Simmons in Accelerated Intelligence

7 Little Things That Can Tell You A Lot About Someone

Anthony J. Yeung in Mind Cafe

Yes, You Can Do That During the Work Day

Laura Vanderkam in Forge

About

Help

Legal

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store