MenuGuides / Try a React component

Docs / Guides

Try a React component

Start from the React Starter, and see the page beside the code as you change it.

On this page

React needs no setup: no project, no build step, no install. The React Starter comes with React 19 and runs offline.

Open the React Starter

  1. Click React on the Home screen. With a Snippet open, click + at the end of the tabs and choose React.
  2. Wait a moment. With Run as you type on, as it is at first, the Starter runs by itself, and its page appears beside the code: a counter with − and + buttons.
The React Starter: the component, and beside it the page, with its console one tab away.

The strip over the code has two Parts: JSX, the component, and CSS, the page's styles, with Tailwind turned on. See Web pages.

Change the component

  1. In the JSX Part, change the component. For example, make + add 10: setCount((n) => n + 10).
  2. Stop typing. A moment later, JSpark runs the Snippet again and the page shows your change.
The component in the JSX Part: useState holds the count, useEffect prints it.

The page is a real page in Chromium, in a process of its own. To run the code yourself at any time, press ⌘↵ or Ctrl+Enter.

Read the page’s console

What the page prints with console.log appears in the Console tab, beside Page. The Starter prints count each time it changes, so each click adds a line. Switching tabs doesn’t reload the page.

Each click changes the count on the page and prints it in the console.

To give the page the whole window, choose Output only in the Layout menu, at the right end of the tab strip.

The pictures show JSpark on a Mac. On Windows, the window buttons are at the top right, the menus are in theMenu button at the left end of the tabs, and shortcuts use Ctrl where a Mac uses ⌘. The rest works the same way.

Esc

Type to search every docs page.

JSpark is downloading

When you open JSpark-Setup.exe, Windows may stop it once, because the installer isn’t code-signed yet. If the file came from jspark.app:

A blue Windows box, “Windows protected your PC”: Microsoft Defender SmartScreen prevented an unrecognised app from starting. Under it, the link More info, and the button Don’t run.

1Click More info.

The same box after More info: Application JSpark-Setup-1.4.0.exe, Publisher Unknown publisher, and the buttons Run anyway and Don’t run.

2Then click Run anyway.

You see this only once: updates install inside the app. More in Install JSpark.