Last active
July 15, 2020 16:36
-
-
Save topspinppy/ff1be251cfaa570f25480468020fdbcb to your computer and use it in GitHub Desktop.
This file contains 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
class Noti extends React.Component { | |
show() { | |
console.log("show"); | |
} | |
render() { | |
return "eee"; | |
} | |
} | |
export default class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.notiRef = React.createRef(); | |
} | |
componentDidMount() { | |
if (this.notiRef) { | |
this.notiRef.show(); | |
} | |
} | |
render() { | |
return <Noti ref={el => (this.notiRef = el)} />; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment