Created
November 27, 2016 04:28
-
-
Save arvitaly/1a93e0fb5e6be14d58acf5f96be1a304 to your computer and use it in GitHub Desktop.
React own element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jsdom = require("jsdom"); | |
import React = require("react"); | |
import ReactElementSymbol = require("react/lib/ReactElementSymbol"); | |
import ReactDOM = require("react-dom"); | |
const window = jsdom.jsdom(`<div id="root"></div>`).defaultView; | |
global['window'] = window; | |
global['document'] = window.document; | |
class A extends React.Component<any, any>{ | |
render() { | |
return { propTypes: { test: React.PropTypes.any }, '$$typeof': ReactElementSymbol, type: "ggg-x", key: "aaa", props: { test: "xxx" } } | |
} | |
} | |
//console.log(React.isValidElement( { '$$typeof': ReactElementSymbol, type: "ggg", key: "aaa", props: {} })) | |
ReactDOM.render(<A />, document.getElementById("root")); | |
console.log(document.getElementById("root").innerHTML); | |
//console.log(<A />) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment