Skip to content

Commit e7d857d

Browse files
committed
Refactor ref callbacks for LinearGradient and Texture
Updated ref callback functions to use explicit if statements for setting refs in LinearGradient and Texture components. This improves readability and consistency in the Scene component.
1 parent 4e62bbc commit e7d857d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Playground.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,9 @@ function Scene() {
308308
{/* Linear Gradient Example */}
309309
<Group x={cellWidth * 1.5} y={cellHeight * 3.5}>
310310
<LinearGradient
311-
ref={(ref) => ref && setLinearGradient(ref)}
311+
ref={(ref) => {
312+
if (ref) setLinearGradient(ref);
313+
}}
312314
x1={0}
313315
y1={0}
314316
x2={1}
@@ -347,7 +349,9 @@ function Scene() {
347349
{/* Texture Example */}
348350
<Group x={cellWidth * 3.5} y={cellHeight * 3.5}>
349351
<Texture
350-
ref={(ref) => ref && setTexture(ref)}
352+
ref={(ref) => {
353+
if (ref) setTexture(ref);
354+
}}
351355
src="https://placehold.co/60x60/9B59B6/FFFFFF?text=TEX"
352356
/>
353357
<Rectangle

0 commit comments

Comments
 (0)