11import React , { useState , MouseEvent } from 'react'
2- import ReactDOM from 'react-dom' ;
2+ import { createRoot } from 'react-dom/client ' ;
33import Terminal , { ColorMode , TerminalInput , TerminalOutput } from '../src/index' ;
44
55import './style.css' ;
66
7- const TerminalController = ( props = { } ) => {
7+ const TerminalController = ( ) => {
88 const [ isPasswordMode , setIsPasswordMode ] = useState < boolean > ( false ) ;
99 const [ colorMode , setColorMode ] = useState ( ColorMode . Dark ) ;
1010 const [ lineData , setLineData ] = useState ( [
11- < TerminalOutput > Welcome to the React Terminal UI Demo!& #128075 ; </ TerminalOutput > ,
12- < TerminalOutput > </ TerminalOutput > ,
13- < TerminalOutput > The following example commands are provided:</ TerminalOutput > ,
14- < TerminalOutput > ' view-source' will navigate to the React Terminal UI github source.</ TerminalOutput > ,
15- < TerminalOutput > ' view-react-docs' will navigate to the react docs.</ TerminalOutput > ,
16- < TerminalOutput > ' login' will show input password with "*" instead of real string</ TerminalOutput > ,
17- < TerminalOutput > ' clear' will clear the terminal.</ TerminalOutput > ,
11+ < TerminalOutput key = "welcome" > Welcome to the React Terminal UI Demo!& #128075 ; </ TerminalOutput > ,
12+ < TerminalOutput key = "empty" > </ TerminalOutput > ,
13+ < TerminalOutput key = "commands" > The following example commands are provided:</ TerminalOutput > ,
14+ < TerminalOutput key = "view-source" > ' view-source' will navigate to the React Terminal UI github source.</ TerminalOutput > ,
15+ < TerminalOutput key = "view-react" > ' view-react-docs' will navigate to the react docs.</ TerminalOutput > ,
16+ < TerminalOutput key = "login" > ' login' will show input password with "*" instead of real string</ TerminalOutput > ,
17+ < TerminalOutput key = "clear" > ' clear' will clear the terminal.</ TerminalOutput > ,
1818 ] ) ;
1919
2020 function toggleColorMode ( e : MouseEvent ) {
@@ -85,9 +85,10 @@ const TerminalController = (props = {}) => {
8585 )
8686} ;
8787
88- ReactDOM . render (
88+ const container = document . getElementById ( 'terminal' ) ! ;
89+ const root = createRoot ( container ) ;
90+ root . render (
8991 < React . StrictMode >
9092 < TerminalController />
91- </ React . StrictMode > ,
92- document . getElementById ( 'terminal' )
93+ </ React . StrictMode >
9394) ;
0 commit comments