Skip to content

AK0041

Required prop is missing

What happened

A parent component rendered a child without passing one or more required props. The child's prop definition marks certain props as required, and they were not provided.

How to fix

Pass all required props when rendering the component. Check the component's prop definitions to see which props are expected.

Example

ts
// Bad — "title" prop is required but missing
const Card = defineComponent<{ title: string; subtitle?: string }>((props) => {
  return () => h("div", {}, props.title);
});

const App = defineComponent(() => {
  return () => h(Card, {}); // missing required "title"
});

// Good — pass all required props
const App = defineComponent(() => {
  return () => h(Card, { title: "Hello" });
});

Released under the MIT License.