Skip to content

Instantly share code, notes, and snippets.

@topspinppy
Last active July 15, 2020 16:36
Show Gist options
  • Save topspinppy/ff1be251cfaa570f25480468020fdbcb to your computer and use it in GitHub Desktop.
Save topspinppy/ff1be251cfaa570f25480468020fdbcb to your computer and use it in GitHub Desktop.
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