Dev Helpers
← Back

Pan size substitution

Import and render <PanSizeSubstitution /> in a React project.

Open this example in the interactive library

Live preview

Source code

// components/PanSizeSubstitution.tsx

import { useState } from "react";

export default function PanSizeSubstitution() {
  const [diameter, set] = useState(24);
  return (
    <label>
      New round pan cm
      <input
        type="range"
        min={12}
        max={36}
        value={diameter}
        onChange={(e) => set(+e.target.value)}
      />
      <output>Multiply a 20 cm recipe by {(diameter ** 2 / 400).toFixed(2)}</output>
    </label>
  );
}