React Runner

Playground
Run your React code on the go, in different ways

Inline element

React Runner

  • Inline element
  • Function component
  • Class component, with class fields support
  • Composing components with render or export default
  • Server Side Rendering
  • import statement
  • Multi files
  • Typescript

Function Component

Class Component with fields support

export default Component

render(<Component />)

Hacker News (Typescript)

Hacker News

1 / 10
loading...

Multi files (using CodeMirror)

import { useReducer } from 'react'
import AddTask from './AddTask.js'
import TaskList from './TaskList.js'

let nextId = 3
const initialTasks = [
{ id: 0, text: 'Philosopher’s Path', done: true },
{ id: 1, text: 'Visit the temple', done: false },
{ id: 2, text: 'Drink matcha', done: false },
]

export default function TaskBoard() {
const [tasks, dispatch] = useReducer(tasksReducer, initialTasks)

function handleAddTask(text) {
dispatch({
type: 'added',
id: nextId++,
text: text,
})
}

function handleChangeTask(task) {
dispatch({
type: 'changed',
task: task,
})
}

function handleDeleteTask(taskId) {
dispatch({
type: 'deleted',
id: taskId,
})
}

Day off in Kyoto

App.js
AddTask.js
TaskList.js