Memorisely
Design Engineering

React components for designers

Props, state and variants through a designer's eyes.

Zander Whitehurst

9 min read

If you have built a component library in Figma, you already understand React better than you think. Components, properties, variants and instances are all ideas that exist in both worlds, often with almost identical names.

The difference is that React components actually do things. They respond to clicks, remember what the user has typed and change based on real data. Once you see how the design concepts you know map onto React, reading the code your AI tools produce becomes far less intimidating.

A component is a reusable piece of UI

In Figma, a component is a master you can reuse across your designs. In React, it is exactly the same idea, written as a function that returns some markup:

function Badge() {
  return <span className="rounded-full bg-gray-100 px-2 py-1 text-sm">New</span>;
}

You can then use it anywhere with <Badge />, the same way you would drop an instance into a frame. Change the component once and every instance updates.

Props are component properties

That badge always says "New", which is not very useful. In Figma you would add a text property so each instance can have its own label. In React, that is a prop:

function Badge({ label }) {
  return <span className="rounded-full bg-gray-100 px-2 py-1 text-sm">{label}</span>;
}

<Badge label="Beta" />

Props are how information flows into a component. Text, images, colours, whether something is selected. If it would be a property in Figma, it is probably a prop in React.

Most of what you already know from Figma libraries maps directly onto a React concept.

The first time this clicked for me, I said "oh, it is just component properties" out loud in a quiet office. Nobody looked up. I like to think they were impressed.

Variants are props too

Figma variants let you switch between versions of a component, like a primary or secondary button. In React, variants are usually just props with a limited set of values:

function Button({ variant = "primary", children }) {
  const styles = {
    primary: "bg-blue-600 text-white",
    secondary: "bg-white text-gray-900 border",
  };
  return <button className={`rounded-lg px-4 py-2 ${styles[variant]}`}>{children}</button>;
}

Notice the variant = "primary" part. That is the default value, just like the default variant you set in Figma. If nobody specifies one, you get primary.

Children are slots

Sometimes you want a component to wrap other content, like a card that can hold anything. In Figma you might use a slot or a nested instance you swap out. In React, that is children.

Anything you put between the opening and closing tags of a component is passed in as children. It is what lets you build flexible containers like cards, modals and panels without designing every combination.

State is what the component remembers

This is the part Figma does not really have. State is information a component keeps track of while someone is using it. Whether a dropdown is open. What has been typed into a field. Which tab is selected.

function Toggle() {
  const [on, setOn] = useState(false);
  return <button onClick={() => setOn(!on)}>{on ? "On" : "Off"}</button>;
}

The simplest way to think about it: props come from outside, state lives inside. When state changes, React redraws the component automatically.

Interactive states are not the same as state

Here is a common confusion. Hover, focus and pressed states in Figma are usually handled with CSS in code, not React state. A button does not need to remember it is being hovered. The browser already knows.

Knowing this helps you brief AI tools properly. Ask for hover and focus styles in the classes, and save state for things the component genuinely needs to remember.

The browser already handles hover and focus, so React state is only for what a component must remember.

Composition is just nesting

Big interfaces are built from small components nested inside each other. A page contains a header, which contains a navigation, which contains links. That is composition, and it is exactly how you build complex frames from smaller components in Figma.

When you review AI built UI, look for this structure. If a page is one enormous component with hundreds of lines, it is usually a sign that it should be broken up. I once received a single component called Dashboard that was eight hundred lines long. It was less a component and more a cry for help.

Reading a component you did not write

When you open an unfamiliar component, read it in this order:

  1. The name, which tells you what it is for
  2. The props at the top, which tell you what it can be customised with
  3. Any state, which tells you what it remembers
  4. The markup it returns, which tells you what it looks like

You do not need to understand every line. If you can answer those four questions, you understand the component well enough to review and direct changes.

Answering four questions in order is enough to review a component you did not write.

Start with your button

Open your product's codebase and find the button component. Read it using the four questions above. List its props and variants, then compare them with the button in your Figma library. Note any differences. That small comparison will teach you more about React than any tutorial, and it often uncovers a few gaps worth fixing in both places. Our Frontend UI for Designers workshop is a good next step, and the AI Design Engineering Bootcamp goes deep on React and Tailwind.

Keep reading

View all
View all

Optimize your AI for better experiences, not AI slop.

View all

AI Prototyping Skills

Prototype with AI using clean UI patterns and guardrails so flows feel product-grade, not generic template slop.

$99

AI UI Motion Skills

Motion and micro-interaction patterns that make AI-built UI feel designed, polished, and trustworthy in real products.

$99

Fix AI Slop Skills

Spot AI slop early and fix type, spacing, and components so your product looks intentional, not like a template.

$99

AI Responsive Design Skills

Responsive layout patterns for rails, sidebars, and breakpoints so AI-generated UI adapts cleanly from narrow to wide.

$99

AI Dark Mode Skills

Dark theme tokens, contrast, and surfaces that keep AI-generated UI readable and product-grade, not flat gray on black.

$99

AI Color Token Skills

Neutral and primary ramps with clear steps so AI palettes stay systematic, not a random set of accent hex codes.

$99
View all