The DOM is not your html
The DOM is not view source
The dev tools in your favorite browser provide a visual representation of the dom.
This is the best and easiest way I know to inspect the DOM.
Open up the dev tools and ch-ch-check out the "Elements" tab.
JSX is just a way for us to write biz that looks like html in our javascript render functions.
//javascript object style
const virtualNode = {
nodeAttributes: {
id: 'virtual-node-id'
},
nodeName: 'h1',
children: ['Virtual Header Text']
}
//jsx style
const virtualNodeJSX = (
return <h1 id='virtual-node-id'>Virtual Header Text</h1>
);//jsx style
const virtualNodeJSX = (
return <h1 id='virtual-node-id'>Virtual Header Text</h1>
);
//babel (or other transpiler takes that and turns it into something like
var virtualNodeJSX = makeVirtualNode('h1', {id:"virtual-node-id"}, 'Virtual Header Text!');
This last piece makeVirtualNode just takes the input given, creates the virtual node object and then calls our render!
See hyperscript or the react source code for an implementation. Its actually simpler than our render.
All JSX is