Skip to content

Commit

Permalink
Fix: avoid inititializing RGL on each render (prevents rerenders)
Browse files Browse the repository at this point in the history
  • Loading branch information
joost-stessens committed Sep 9, 2024
1 parent 9811a8a commit 0f4429b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drag-n-drop-chart-library/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ import userflow from "userflow.js";
userflow.init("ct_65z5oczamna45bveai47cpcbpe");
userflow.identifyAnonymous();

// initialize RGL
const ReactGridLayout = WidthProvider(RGL);

export default function App() {
// initialize state
const [open, setOpen] = React.useState(false);
const [layout, setLayout] = React.useState(initialState.layout);
const [activeCharts, setActiveCharts] = React.useState(
initialState.activeCharts
);
// initialize RGL
const ReactGridLayout = WidthProvider(RGL);

// App functions
const handleClearCharts = () => {
Expand Down

0 comments on commit 0f4429b

Please sign in to comment.