From 6f66a2136461867a9369681d4e1a5976ac368700 Mon Sep 17 00:00:00 2001 From: Severin Ibarluzea Date: Fri, 11 Mar 2022 01:56:22 -0800 Subject: [PATCH] allow JS repl with initialLines --- package.json | 2 +- src/ReactReplJS.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6bc4f4a..dd5c374 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "awesome-react-repl", - "version": "1.0.1", + "version": "1.0.2", "main": "dist/ReactReplJS.js", "dependencies": { "pretty-format": "^26.6.2", diff --git a/src/ReactReplJS.js b/src/ReactReplJS.js index b5e881d..f47ec70 100644 --- a/src/ReactReplJS.js +++ b/src/ReactReplJS.js @@ -28,11 +28,12 @@ export const ReactReplJS = ({ tabs, selectedTab, onChangeTab, + initialLines = [], initiallyExecute = [], height, submitCodeRef = null, }) => { - const [lines, setLines] = useState([]) + const [lines, setLines] = useState(initialLines) const onSubmit = async (execLine) => { const newLines = lines.concat([{ type: "input", value: execLine }])