DEV Community

Cover image for Build your own React in 90 lines of JavaScript

Build your own React in 90 lines of JavaScript

Ameer Jhan on November 05, 2019

What I cannot create, I do not understand - Richard Feynman When I started learning React I felt whatever it did was pure magic, then I started ...
Collapse
 
joeyhipolito profile image
Jose Marcelius Hipolito

Found an issue where if you

export default compose(Enhancer)(WrappedComponent)

where WrappedComponent extends from Component

and WrappedComponent overrides componentDidMount of Component

componentDidMount will be undefined.(not undefined, but cannot be overridden)

Collapse
 
vivek0712 profile image
Vivek0712

Amazing article and thanks for sharing!

Collapse
 
ameerthehacker profile image
Ameer Jhan

thanks, glad that you liked it

Collapse
 
rendez profile image
Luis Merino • Edited

-- SPOILER --



children.flat()



--- END SPOILER ---

Collapse
 
codeanit profile image
Anit Shrestha Manandhar

Great write-up! Thank you.

Collapse
 
nicolasdanelon profile image
Nicolás Danelón

hahahaha, good stuff! I've love this article, thanks

Collapse
 
ameerthehacker profile image
Ameer Jhan

Thanks, glad that you liked it

Collapse
 
codenutt profile image
Jared

This is awesome! Thanks for sharing. It definitely helps to understand the "magic"

Collapse
 
ameerthehacker profile image
Ameer Jhan

Thaks glad that you liked it

Collapse
 
sharmaarun profile image
Arun Sharma

Loved the simplicity put into impl. :)

Collapse
 
ameerthehacker profile image
Ameer Jhan

Thanks, glad that you liked it

Collapse
 
andrianmauricio profile image
Mauricio Andrian

This is so amazing! I love it. I may do a tutorial some day and I will definitely come back to this post and absolutely tag you! You're awesome.

Collapse
 
ameerthehacker profile image
Ameer Jhan

thanks, glad that you liked it

Collapse
 
yvettelau profile image
YvetteLau

Intersting and inspiring article!

Can I translate it into Chinese to help more developers?

I will give credit at the top of the article.

Collapse
 
ameerthehacker profile image
Ameer Jhan

Sure please goahead

Collapse
 
mustafaabobakr profile image
Mostafa Abobakr

The original author: pomb.us/build-your-own-react/

Collapse
 
ameerthehacker profile image
Ameer Jhan • Edited

I did draw the inspiration from Pomber's post but this post has an all together different approach in implementation, this is way simpler and does not implement hook, vdom and fiber architecture as Pomber's. Is pomber's implementation is 90 lines or was there no post on creating your React before Pomber, Pomber has his own way of making things interesting and this is mine. please read the post before commenting

Collapse
 
oh_jeez_rick profile image
Gavin Chan

Good posting, thanks

Collapse
 
agustito37 profile image
Agustín • Edited

Thanks for this great article!

Could it be that this implementation doesn't support nested Class Components?

Collapse
 
saket23 profile image
Saket23

Very well and easy to understand bro.

I have one doubt , why to write __updater inside react-dom as a property of QndReact . We can use it directly as a property of QndReactDom ?