Skip to content

Introducing Playground

Playground is a React Component that can be used for demonstrating HTML, CSS and JavaScript code.

Features

  1. Allows bare ES package imports. This means you can add imports for any library that supports ES Module resolution and playground will automatically load it into your code.
  2. Load preview for predefined code.
  3. Autoreloading preview.
  4. See console output in the component itself.
  5. Control tab loaded by default for your use-case.

How does module imports work?

If an NPM package exposes an endpoint for "module", then you can direcly import this package by it's name.

format(new Date(2014, 1, 11), "yyyy-MM-dd");

Unfortunately, not all packages currently support this feature. You can search through an entire list of packages through pika.dev.

You can use community created packages to replicate the functionality. For eg. React would be:

ReactDOM.render(
  createElement("div", {}, "Hello World"),
  document.getElementById("app"),
);

See Complete Documentation


Stay ahead of the curve in Web Development with Javascript Every Month Newsletter.

I will deliver a curated selection of articles, tutorials, and resources straight to your inbox once a month.

Read the Archives

Subscribe to JEM Newsletter

No spam, unsubscribe anytime.