File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ <h1>JSX</h1>
60
60
< section style ="text-align: left; ">
61
61
< h2 > Example</ h2 >
62
62
< pre > < code class ="hljs ">
63
+ import * as React from "react";
64
+ import { render } from "react-dom"
65
+
63
66
class ShoppingList extends React.Component {
64
67
render() {
65
68
return (
@@ -74,6 +77,14 @@ <h1>Shopping List for {this.props.name}</h1>
74
77
);
75
78
}
76
79
}
80
+
81
+ let baseDiv = document.querySelector("#root");
82
+
83
+ // Note the this.props.name. We can pass that prop during construction as below:
84
+ // Props in react are just attributes on their
85
+
86
+ // Below is the render function from react-dom. It injects a react component into a component in the regular dom.
87
+ render(< ShoppingList name ="Whatever " /> , baseDiv)
77
88
</ code > </ pre >
78
89
</ section >
79
90
</ div >
You can’t perform that action at this time.
0 commit comments