Currently this will fail:
return <Canvas scene={{ background: [1, 0, 0] }} />`
- When encountering an array, the prop handling will try to
target[propName].set(...propValue)
- Because
Scene.background is null initialized, there is nothing to .set to
The current solution is to pass a THREE.Color instead:
return <Canvas scene={{ background: new Color(1, 0, 0) }} />`
But maybe there could be a way to declare
- if
prop[key] exists 👉 prop[key].set(...values)
- if
prop[key] exists 👉 prop[key] = new Constructor(...values)
Proposal
Maybe something like:
<Canvas scene={{ background: setOrInit(Color, [1, 0, 0]) }} />
a bit in the vein of https://github.com/tc39/proposal-upsert ?
Currently this will fail:
target[propName].set(...propValue)Scene.backgroundis null initialized, there is nothing to.settoThe current solution is to pass a
THREE.Colorinstead:But maybe there could be a way to declare
prop[key]exists 👉prop[key].set(...values)prop[key]exists 👉prop[key] = new Constructor(...values)Proposal
Maybe something like:
a bit in the vein of https://github.com/tc39/proposal-upsert ?