- 1 use ref and useEffect & interval to update the simulation at a constant time, storing the result in a ref
- 1 state & useEffect & animation frame to derive the state from the information in the ref
- 1 use ref and useEffect & interval to update the simulation at a constant time, storing the result in a ref
- 1 state & useEffect & animation frame to derive the state from the information in the ref
Then using the data in state, return JSX with the SVG nodes, and react will diff the changes, only making the required changes to the dom, making rendering pretty seamless.
Then using the data in state, return JSX with the SVG nodes, and react will diff the changes, only making the required changes to the dom, making rendering pretty seamless.
const Sim = () => {
const [state, setState] = useState();
useEffect(() => {
let i
const f = () => {
setState(current => ({}))
i = requestAnimationFrame(f)
}
f()
return () => cancelAnimationFrame(i);
}, [])
// …
}
const Sim = () => {
const [state, setState] = useState();
useEffect(() => {
let i
const f = () => {
setState(current => ({}))
i = requestAnimationFrame(f)
}
f()
return () => cancelAnimationFrame(i);
}, [])
// …
}
Using OR would allow every combination except unsafe and sound
Using OR would allow every combination except unsafe and sound
- A custom built NAS running Debian and ZFS (where I run my home services)
- A portable rack in a flight case (for event lighting) with a dream machine, M2 Mac Mini, DMX output, power twist power distribution & 16A Power in 😄
- A custom built NAS running Debian and ZFS (where I run my home services)
- A portable rack in a flight case (for event lighting) with a dream machine, M2 Mac Mini, DMX output, power twist power distribution & 16A Power in 😄
Exactly as we expected, but worse than we thought
Exactly as we expected, but worse than we thought