File tree 1 file changed +11
-9
lines changed
1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,8 @@ import './App.css';
2
2
import { ThreeWrapper } from './components/threeWrapper/ThreeWrapper' ;
3
3
import { useControls } from 'leva' ;
4
4
5
- /*
6
- This App.js conditionally adds/removes a ThreeWrapper component
7
- based on the threeLoaded state variable
8
- */
9
-
10
- function MyComponent ( ) {
11
- const { speedX, speedY, scale } = useControls ( {
5
+ function WrapperWithControls ( ) {
6
+ const { speedX, speedY, scale, mounted } = useControls ( {
12
7
speedX : {
13
8
value : 0.15 ,
14
9
min : 0 ,
@@ -27,16 +22,23 @@ function MyComponent() {
27
22
max : 4 ,
28
23
step : 0.1 ,
29
24
} ,
25
+ mounted : true ,
30
26
} ) ;
31
27
return (
32
- < ThreeWrapper props = { { speedX : speedX , speedY : speedY , scale : scale } } />
28
+ < >
29
+ { mounted && (
30
+ < ThreeWrapper
31
+ props = { { speedX : speedX , speedY : speedY , scale : scale } }
32
+ />
33
+ ) }
34
+ </ >
33
35
) ;
34
36
}
35
37
36
38
function App ( ) {
37
39
return (
38
40
< div className = "App" >
39
- < MyComponent />
41
+ < WrapperWithControls />
40
42
</ div >
41
43
) ;
42
44
}
You can’t perform that action at this time.
0 commit comments