Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does react use html4, html5 or jsx?

Tags:

html

reactjs

Following this question, i got confused. I saw people saying that react uses html, and people saying it uses jsx, but people dont mention which type of html it uses.

Here is the question i followed:

Does ids must start with a letter in react?

Could somebody clarify?

like image 531
Jacs Avatar asked Oct 23 '25 15:10

Jacs


1 Answers

JSX stands for JavaScript XML, which you could say is a more powered up version of Vanilla Javascript. In the end JSX is compiled by preprocessors to Javascript (ES5). React uses JSX for rendering html and performing other actions, but you don't need to use JSX if you're not too comfortable with it. You may use vanilla JS as well.

As for whether it mimics HTML4 or HTML5, it depends on what you code, React itself is not limited to any HTML version and it is the browser that needs to worry about which HTML version you are using.

If your document has

<!DOCTYPE html>

browsers would recognise your document as HTML5. If you instead use

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

browsers would recognize the document as HTML4 (strict in this case)

like image 166
Arun A S Avatar answered Oct 26 '25 04:10

Arun A S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!