Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Created January 8, 2019 03:17
Show Gist options
  • Save ajcrites/0f5a0461111a08b978a8ae9dacdad696 to your computer and use it in GitHub Desktop.
Save ajcrites/0f5a0461111a08b978a8ae9dacdad696 to your computer and use it in GitHub Desktop.
export class About extends React.Component {
contentRef = React.createRef();
async animate(show) {
...
this.setState({ show });
}
render() {
return this.state.show ?
<AboutContent ref={this.contentRef} /> :
null;
}
}
export const About = () => {
const contentRef = useRef(null);
const [show, setShow] = useState(false);
const animate = async show => {
...
setShow(show);
}
return show ? <AboutContent ref={contentRef} /> : null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment