Skip to content

Commit

Permalink
feat: throw a useful error if component missing from components
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvxd committed Nov 4, 2018
1 parent 78a1a91 commit f873219
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class ReactFromJSON<
throw "Detected `ComponentLookup` prop on a component, but `components` is undefined. You need to define `components` if using `ComponentLookup` props.";
}

if (!components[componentType]) {
throw `Detected \`${componentType}\` ComponentLookup, but it's not defined in your \`components\` object.`;
}

const component = components[componentType][componentIndex];

return this.renderComponent({
Expand Down

0 comments on commit f873219

Please sign in to comment.