Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

awesome-react-repl

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awesome-react-repl

Display or interact with a REPL (Read Eval Print Loop). Create an interactive terminal for Python, Javascript or whatever in React.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

(Awesome) React Repl

Display or interact with a REPL (Read Eval Print Loop). Create an interactive terminal for Python, Javascript or whatever in React.

Try it out

promises error

Usage

npm install awesome-react-repl

Javascript REPL

import { ReactReplJS } from "awesome-react-repl"

const JavascriptRepl = () => {
  return  (
    <ReactReplJS
      title="My Javascript Repl!"
      height={300}
      initiallyExecute={["a = 3", "b = 4", "a * b"]}
    />
  )
}

General-Purpose REPL UI

import { ReactReplView } from "awesome-react-repl"

const GeneralPurposeReplUI = () => {
  return  (
    <ReactReplView
      title={`My Awesome Repl!`}
      tabs={["Javascript", "Python"]}
      selectedTab="Javascript"
      onChangeTab={action("onChangeTab")}
      onSubmit={action("onSubmit")}
      onClear={action("onClear")}
      height={200}
      lines={[
        { type: "input", value: "obj = { something: 2 }" },
        { type: "output", value: '{ "something": 2 }' },
        { type: "input", value: "b" },
        { type: "error", value: "TypeError: b is not defined" },
      ]}
    />
  )
}

Advanced Javascript REPL Usage

import { useReactReplJS } from "awesome-react-repl"

const JavascriptRepl = () => {
  const { submitCode, ReactRepl } = useReactReplJS() 
  return  (
    <div>
      <ReactRepl
        title="My Javascript Repl!"
        height={300}
        initiallyExecute={["a = 3", "b = 4", "a * b"]}
      />
      <button onClick={() => submitCode('alert(`Button pressed! a=${a}! This will appear in the REPL!`)')}>Alert!</button>
    </div>
  )
}

Development

  1. Run yarn install
  2. Run yarn storybook

FAQs

Package last updated on 11 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc