File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
app/src/components/bottom Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -24,13 +24,9 @@ const CodePreview: React.FC<{
24
24
} > = ( { theme, setTheme } ) => {
25
25
26
26
27
-
28
-
29
27
const ref = useRef < any > ( ) ;
30
28
const iframe = useRef < any > ( ) ;
31
- const [ input , setInput ] = useState ( '' ) ;
32
-
33
-
29
+
34
30
35
31
const startService = async ( ) => {
36
32
ref . current = await esbuild . startService ( {
@@ -49,6 +45,10 @@ const CodePreview: React.FC<{
49
45
const currentComponent = state . components . find (
50
46
( elem : Component ) => elem . id === state . canvasFocus . componentId
51
47
) ;
48
+ const [ input , setInput ] = useState ( currentComponent . code ) ;
49
+
50
+ console . log ( 'this is state' , state . components )
51
+ console . log ( 'currentcomponent.code' , currentComponent . code )
52
52
53
53
54
54
const handleCodeSnipChange = ( val ) => {
@@ -64,8 +64,8 @@ const CodePreview: React.FC<{
64
64
} , [ height ] )
65
65
66
66
useEffect ( ( ) => {
67
- console . log ( 'hello' )
68
- } , [ currentComponent . code ] )
67
+ setInput ( currentComponent . code )
68
+ } , [ state ] )
69
69
70
70
71
71
const handleChange = ( data ) => {
You can’t perform that action at this time.
0 commit comments