Skip to content

Commit f873219

Browse files
committed
feat: throw a useful error if component missing from components
1 parent 78a1a91 commit f873219

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ class ReactFromJSON<
5454
throw "Detected `ComponentLookup` prop on a component, but `components` is undefined. You need to define `components` if using `ComponentLookup` props.";
5555
}
5656

57+
if (!components[componentType]) {
58+
throw `Detected \`${componentType}\` ComponentLookup, but it's not defined in your \`components\` object.`;
59+
}
60+
5761
const component = components[componentType][componentIndex];
5862

5963
return this.renderComponent({

0 commit comments

Comments
 (0)