Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. React useEffect brought down Cloudflare - DDoS self!

React useEffect brought down Cloudflare - DDoS self!

Scheduled Pinned Locked Moved The Lounge
2 Posts 1 Posters 70 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Graeme_GrantG Offline
    Graeme_GrantG Offline
    Graeme_Grant
    wrote last edited by
    #1

    You can read about it here: Cloudflare DDoSed itself with React useEffect hook blunder or this YouTube video: Cloudflare in trouble...

    “I fear not the man who has practised 10,000 kicks once, but I fear the man who has practised one kick 10,000 times.” - Bruce Lee.

    1 Reply Last reply
    0
    • realJSOPR Offline
      realJSOPR Offline
      realJSOP
      wrote last edited by
      #2

      My standard practice now is to put all functions into useCallback, and not putting functions into any dependency array (there's no need for that if everything all of the component's functions are in useCallback hooks, right?). I also tend to have a useEffect with an empty dependency array for component init, and maybe one or two for monitored states. Most of my states are actually maintained in a Zustand store, and that store exposes a get/set function pair for every state because I don't always want to know when a state changes within a given component, but I still want to be able to get or set that state.

      I don't know if this is "best practice" or not, but it seems to work out well...

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups