-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heads-up in reactjs #7
Comments
in react, children prop can be a node or can be an array or even an iterator which yields node type object; // the input JSX
const eles = [1,2,3];
<div>
<div></div>
{[1,2,3]}
{eles.map(data=>{
return (<li>data</li>)
})}
</div>
// -----------------------------
// the output createElement js
var eles = [1, 2, 3];
React.createElement(
"div",
null,
React.createElement("div", null),
[1, 2, 3],
eles.map(function (data) {
return React.createElement(
"li",
null,
"data"
);
})
); |
react element
var element = {
// This tag allow us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE,
// Built-in properties that belong on the element
type: type,
key: key,
ref: ref,
props: props,
// Record the component responsible for creating this element.
_owner: owner,
}; |
in react, here are some types that you should know: So,
|
react
React.createElement React.cloneElement
&&document.createElement element.cloneNode
react-proxy
quetions from reading the react source code
isNative
?if you call
setState
in the same event loopmany times
, it won't cause to render many timesbut you shouldn't do that if it can be avoided
make clear about the background mechanism of
react-router v4, bundle-loader
,to helpwrite components with more approaches.
react-router
advice: fork the repository and do some notes in it and add a link here
The text was updated successfully, but these errors were encountered: