Guest User

Untitled

a guest
Dec 7th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. import React from 'react'
  2. import ReactDOM from 'react-dom'
  3.  
  4. module.exports = (WrappedComponent) => {
  5. class FadeInComponent extends React.Component {
  6. componentDidMount () {
  7. // Get the components DOM node
  8. var elem = ReactDOM.findDOMNode(this)
  9. // Set the opacity of the element to 0
  10. elem.style.opacity = 0
  11. window.requestAnimationFrame(() => {
  12. // Now set a transition on the opacity
  13. elem.style.transition = 'opacity 250ms'
  14. // and set the opacity to 1
  15. elem.style.opacity = 1
  16. })
  17. }
  18. render () {
  19. return <WrappedComponent {...this.props} />
  20. }
  21. }
  22. return FadeInComponent
  23. }
Add Comment
Please, Sign In to add comment