Parsing React: How It Works


#1

Can anyone tell me what’s going on with React? How is it possible to have HTML tags mixed with JS syntax? Is there some kind of JS-driven, pre-parsing voodoo that the library performs on my code before it passes it along to the JS interpreter?


#2

Same sorcery as PHP: you drop your html inside React and it manages and renders it.

and yes, you are correct , the voodoo happens in the background:

Take a look: https://en.wikipedia.org/wiki/React_(JavaScript_library)#Working_principles


#3

It’s actually a new part of the standard but I believe it started with people adding in their own interpreter. Trust me, you want this feature in React. Early react was this nasty pile of garbage where you hand crafted HTML with a gross verbose API.