File tree Expand file tree Collapse file tree 3 files changed +36
-12
lines changed Expand file tree Collapse file tree 3 files changed +36
-12
lines changed Original file line number Diff line number Diff line change 11import  {  useRef  }  from  'react' ; 
22import  './App.css' ; 
3+ import  SelectTextarea  from  './SelectTextarea' ; 
4+ import  SendFile  from  './SendFile' ; 
35
46function  App ( )  { 
57 const  textareaRef  =  useRef ( null ) ; 
@@ -17,18 +19,8 @@ function App() {
1719 return  ( 
1820 < section  className = "app-section" > 
1921 < div  className = "app-container" > 
20-  < p > 
21-  < textarea  ref = { textareaRef } > </ textarea > 
22-  </ p > 
23-  < p > 
24-  < button  onClick = { onSelectTextClick } > เลือกข้อความทั้งหมด</ button > 
25-  </ p > 
26-  < p > 
27-  < input  type = "file"  ref = { fileRef }  /> 
28-  </ p > 
29-  < p > 
30-  < button  onClick = { onSendClick } > ส่งไฟล์</ button > 
31-  </ p > 
22+  < SelectTextarea  onSelectTextClick = { onSelectTextClick }  ref = { textareaRef }  /> 
23+  < SendFile  onSendClick = { onSendClick }  ref = { fileRef }  /> 
3224 </ div > 
3325 </ section > 
3426 ) ; 
Original file line number Diff line number Diff line change 1+ import  React  from  'react' ; 
2+ 
3+ const  SelectTextarea  =  React . forwardRef ( ( props ,  ref )  =>  { 
4+  return  ( 
5+  < div > 
6+  < p > 
7+  < textarea  ref = { ref } > </ textarea > 
8+  </ p > 
9+  < p > 
10+  < button  onClick = { props . onSelectTextClick } > เลือกข้อความทั้งหมด</ button > 
11+  </ p > 
12+  </ div > 
13+  ) ; 
14+ } ) ; 
15+ 
16+ export  default  SelectTextarea ; 
Original file line number Diff line number Diff line change 1+ import  React  from  'react' ; 
2+ 
3+ const  SendFile  =  React . forwardRef ( ( props ,  ref )  =>  { 
4+  return  ( 
5+  < div > 
6+  < p > 
7+  < input  type = "file"  ref = { ref }  /> 
8+  </ p > 
9+  < p > 
10+  < button  onClick = { props . onSendClick } > ส่งไฟล์</ button > 
11+  </ p > 
12+  </ div > 
13+  ) ; 
14+ } ) ; 
15+ 
16+ export  default  SendFile ; 
                         You can’t perform that action at this time. 
           
                  
0 commit comments