React.createElement(“div”, {
id: “hello”
}, React.createElement( “p”, null, “Lorem, ipsum.”)
);
Without looking at answers:
React.createElement( "div", {
"id": "hello"
}, "Lorem, ipsum");
<div id="hello">
<p> lorem,ipsum </p>
</div>
React.createEelement("div", {
id: "hello"},
React.createEelement(
"p", null, "lorem,ipsum"));
React.createElement(“div”,
{id: “hello”},
React.createElement(“p”, null, “Lorem, ipsum.”)
);
But I get error in browser I think and only get this displayed:
React.createElement(“div”, {id: “hello”}, React.createElement(“p”, null, “Lorem, ipsum.”) );
Full code that I have used and done the layout like yours but still getting the same int the browser…
Code
<div id="hello">
<p>Lorem, ipsum.</p>
</div>
React.createElement(
'div',
{
id: 'hello'
},
React.createElement(
'p',
null,
'Lorem, ipsum.'
)
);
Browser output
Lorem, ipsum.
React.createElement( ‘div’, { id: ‘hello’ }, React.createElement( ‘p’, null, ‘Lorem, ipsum.’ ) );
React.createElement(
'div',
{
id:'hello'
},
React.createElement('p',null,'Lorem, ipsum dolor.')
)
Could you show me the browser console screenshot to see what type of error it is? I’m not sure what sort of error it is.
Thanks
My code for the exercise is below;
React.createElement("div", {id: "hello"}, React.createElement("p", null, "Lorem, ipsum."));
Thanks, I will try that now… disappointed about the level of help
So that code works for you in chrome browser?
I copied and pasted that and in my browser it is just printing everything to the screen, the whole line of code?!?!?!
Hey @thenode369, hope you are well.
Sorry for the delay in the answer, but based on this image, you have just code an html file with the react syntax right? but you have not set your project folder with the modules need it to run properly that kind of react syntax.
Could you please share an image of your project folder?
Carlos Z
Thanks Carlos
This is the doc file code, yes in a html file
And this is the first module code that works fine…
Scratching my head
I think you forget to encapsulate the react code in a script
tag
<script type="text/babel">
... Code here
</script>
Carlos Z
THanks Carlos, I will try that and also I will rewatch the videos as I am sure i copied it line for line as I dont normally nest that way
React.CreateElement(
“div”,
{ id: “hello” },
React.CreateElement(
“p”,
null,
“Lorem, ipsum.”
)
);
element “p” is an inner element in the “div” element
React.createElement("div", {id: "hello"}, React.createElement("p", null, "Lorem, ipsum."));
<div id="root"><p>Lorem, ipsum.</p></div>
<p>Lorem, ipsum.</p>
React.createElement(
'div' ,
{
id 'hello' ,
},
React.createElement(
'P',
'null',
'Lorem, ipsum.'
)
);
ReactDOM.render(
<HelloMessage name="YonTracks" />,
document.getElementById('root')
);
Answer:
"use strict";
/*#__PURE__*/
React.createElement("div", {
id: "hello"
}, /*#__PURE__*/React.createElement("p", null, "Lorem, ipsum."));