"use strict" ; import * as React from 'react' ; import * as ReactDOM from 'react-dom' ; import Console from 'react-console-component' ; import 'react-console-component/main.css' ; interface EchoConsoleState { count : number ; } class EchoConsole extends React . Component < { } , EchoConsoleState > { constructor ( props ) { super ( props ) ; this . state = { count : 0 , } ; } child : { console ? : Console ; } = { } ; echo = ( text ) => { this . child . console . log ( text ) ; this . setState ( { count : this . state . count + 1 , } , this . child . console . return ) ; } ; promptLabel = ( ) => { return this . state . count + "> " ; } ; render ( ) { return < Console ref = { ref => this . child . console = ref } handler = { this . echo } promptLabel = { this . promptLabel } welcomeMessage = { "Welcome to the react-console demo!\nThis is an example of a simple echo console." } autofocus = { true } / > ; } } export function init ( element ) { ReactDOM . render ( < EchoConsole />, element); }