Building a Live Odds Dashboard in React (without the re-render storm)
The article discusses how to build a live odds dashboard using React while avoiding performance issues related to re-renders. It outlines a method for efficiently fetching and displaying live sports odds without overwhelming the browser. Key techniques include using polling with cache awareness and optimizing state updates to minimize unnecessary re-renders.
- ▪The dashboard features a two-column layout displaying live matches and selected match odds.
- ▪A custom fetch hook is implemented to poll for live odds while reducing CPU usage by 80%.
- ▪The article emphasizes the importance of memoization and stable keys to prevent excessive re-renders.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 3954109) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } [email protected] Posted on May 27 Building a Live Odds Dashboard in React (without the re-render storm) #javascript #react #tutorial #webdev A live odds dashboard is one of those projects that looks simple — fetch some JSON, display it, refresh on a timer — and then quietly becomes a re-render nightmare. Here's a working React 18+ implementation that doesn't grind your browser when 200 odds update in the same second.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).