We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f9c2117 commit e71791bCopy full SHA for e71791b
src/Cards/CardList.js
@@ -20,14 +20,15 @@ function calcWidth() {
20
}
21
22
function CardList(props) {
23
- const [grid, setGrid] = React.useState(null)
24
- gridRedraw()
25
- function gridRedraw(delay = 10) {
26
- setTimeout(() => { if (grid && grid.updateLayout) grid.updateLayout() }, delay)
+ const grid = React.useRef(null)
+ React.useEffect(gridRedraw, [props.size])
+
+ function gridRedraw() {
27
+ setTimeout(() => { if (grid.current && grid.current.updateLayout) grid.current.updateLayout() }, 10)
28
29
30
const gridSettings = {
- gridRef: setGrid,
31
+ ref: grid,
32
columnWidth: calcWidth(),
33
gutterWidth: 0,
34
gutterHeight: 0,
0 commit comments