Created
October 2, 2017 18:53
-
-
Save mertkahyaoglu/edad56982631a291af28b7548a9aa2db to your computer and use it in GitHub Desktop.
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 React, { Component } from "react"; | |
import { render, createPortal } from "react-dom"; | |
class List extends Component { | |
render() { | |
return [ | |
<li key="A">First item</li>, | |
<li key="B">Second item</li>, | |
<li key="C">Third item</li>, | |
<OtherList /> | |
]; | |
} | |
} | |
class OtherList extends Component { | |
render() { | |
return createPortal( | |
[ | |
<li>Fourth item</li>, | |
<li>Fifth item</li> | |
], | |
document.getElementById("root2"), | |
); | |
} | |
} | |
render(<List />, document.getElementById("root")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment