frontpage/components/REPL/index.tsx

15 lines
469 B
TypeScript
Raw Normal View History

2021-12-16 00:21:14 +01:00
import { useState } from "react";
2021-12-15 18:56:32 +01:00
import REPLInput from "./REPLInput";
2021-12-16 00:21:14 +01:00
import REPLHistory from "./REPLHistory";
2021-12-15 18:56:32 +01:00
const REPL = () => {
2021-12-16 00:21:14 +01:00
const [history, manipulateHistory] = useState<string[]>([]);
const onCommandExecuted = (result: string[]) => manipulateHistory(result.reverse().concat(history).slice(0, 1000));
return (<>
<REPLHistory history={history} />
<REPLInput historyCallback={onCommandExecuted} />
</>);
2021-12-15 18:56:32 +01:00
};
export default REPL;