Code · 1 file

Sample JSX File

JSX is JavaScript with HTML-like syntax for React components. The JSX sample is a small program — a customer record, a VIP check and a formatted total — that is the same in every language we offer, so you can compare them side by side.

JSX · 596 B

Sample JSX (React) file

An idiomatic JSX (React) example: a customer record type, a VIP check, a total and a formatted loop — the same program in every language we offer.

CC0 · free for any use · Verified by an independent tool · Report a problem

sample.jsx — first linesJSX
// Sample React component — samplefiles.com
import { useState } from 'react';

export function CustomerList({ customers }) {
  const [vipOnly, setVipOnly] = useState(false);
  const shown = vipOnly ? customers.filter((c) => c.balance >= 10_000) : customers;

  return (
    <section>
      <label>
        <input type="checkbox" checked={vipOnly} onChange={(e) => setVipOnly(e.target.checked)} /> VIP only
      </label>
      <ul>
        {shown.map((c) => (
          <li key={c.id}>
            {c.name}: ${c.balance.toFixed(2)}
          </li>
        ))}
      </ul>
    </section>
  );
}

File details

Size
596 B (596 bytes)
MIME type
text/javascript
SHA-256
ae42738d2356e7a25bf0f7edd6e2664211ada5d8f56697200e30ac4e88c9dbfa
MD5
8006025e39af77baa04004c1b16dd362

Download from the command line

curl -L -o sample.jsx https://files.samplefiles.com/code/jsx/sample.jsx

Or check the download in your browser with the checksum calculator.