React Gotchas (So Far)

  • Can't use location.href() in React, will thow you error. Use element.scrollIntoView() instead
  • Use window.innerWidth() to check window size for responsive handling of states (hamburger button for instance), otherwise stick with @media in your CSS
  • Use async/await when fetch(), wrapped in try/catch states to catch all success/errors
  • YES, you CAN still use document, best in render() when elements are indeed rendered, and you are accessing React's virtual DOM