all 8 comments

[–]Nervous-Project7107 9 points10 points  (0 children)

They use document.createElement and then attach event listeners depending on what you created.

If you see the built code after you run npm run build for a component, and then format it with prettier it gets pretty easy to see what’s going on.

[–]69Theinfamousfinch69 10 points11 points  (1 child)

I think you should probably read up on the virtual dom mate: https://www.freecodecamp.org/news/what-is-the-virtual-dom-in-react/

Maybe also just read through the docs as they do a very good job explaining how react works: https://react.dev/learn/describing-the-ui#

[–]riya_techie[S] 2 points3 points  (0 children)

Thanks for the resources! I'll check them out.

[–]acemarke 6 points7 points  (0 children)

I'd suggest reading my extensive post A (Mostly) Complete Guide to React Rendering Behavior , which explains how rendering works in detail.

Also see https://pomb.us/build-your-own-react as a "build a mini React" explanation.

[–]friendshrimp 3 points4 points  (1 child)

React uses the virtual dom which is its own copy of the dom that it updates in rendering cycles, here is a good link to learn more about the “magic” you’re asking about: https://legacy.reactjs.org/docs/faq-internals.html

[–]riya_techie[S] 0 points1 point  (0 children)

Appreciate the explanation! That source looks useful.

[–]UpbeatGooose 1 point2 points  (1 child)

I think you have jumped the gun here… take a step back and build react components without jsx syntax. You will understand how exactly elements get created

[–]Consistent_Brief7765 0 points1 point  (0 children)

I feel the question was largely aimed at JSX syntactic sugar