Color Selector Custom Form Component Element Type Invalid Error
[describe your problem or question]
---Hi All, I'm trying to get the provided ColorSelector form component working in XbyK Color Selector Documentation I was able to get everything set up. I can add the color selector as the Form component in a text field:
but when I add a new content item of that content type I get the following:
With a console error that points to this react error: https://react.dev/errors/306?invariant=306&args%5B%5D=undefined&args%5B%5D=
Element type is invalid. Received a promise that resolves to: undefined.
Haven't worked with React much and followed the Xperience by Kentico documentation to get to this point. Any help in pointing me in the right direction is appreciated.
Environment
- Xperience by Kentico version: [28.2.2]
- .NET version: [6]
- Deployment environment: [local]
- Link to relevant Xperience by Kentico documentation
Answers
If you have the selector appearing in the list, it sounds like you've got the C# code done correctly for the component and you need to check the admin customisation project is set up correctly.
I would double check the organization/project name's match, in the webpack.config.js
file, the csproj of the project that holds your admin c# code, and the class where you've called RegisterClientModule
. All three need to match or the admin project may not load. Some documentation around this can be found here.
If they match, then I would maybe check you've definitely amended the entry point file, src/entry.tsx
, you should add your component like this:
// Exposes components from the module. All added components need to be exported.
export * from "./components/ColorSelector/ColorSelectorFormComponent";
Thanks Liam, that was it. I didn't have it added to the entry.tsx
I don't think the documentation really covers the entry point file - I might submit that as a recommendation to highlight more clearly.
I was getting same error as above one . But after trying above steps , it got resolved . But now i am getting this error entry.kxh.ce4a....07.js:25 Uncaught error: SyntaxError: Unexpected token '<' Object . And content item is not loading . same screen as shown above .
To answer this question, you have to login first.