Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to load up a ReasonReact component #9

Open
johnhaley81 opened this issue May 22, 2020 · 3 comments
Open

Not able to load up a ReasonReact component #9

johnhaley81 opened this issue May 22, 2020 · 3 comments

Comments

@johnhaley81
Copy link

👋

I'm trying to load this up into our workspace and as long as I use the built-in React DOM elements everything is good. But when I try to load up a ReasonReact component I get the following message:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
// CustomDiv.re
[@react.component]
let make = (~children) => <div> children->React.string </div>;
// CustomDivStories.re
open BsStorybook.Story;

let _module = [%bs.raw "module"];

storiesOf("CustomDiv Story", _module)
->add("Chapter I", () => <CustomDiv "Hello bs-storybook!" </CustomDiv>);

What am I doing wrong?

@davesnx
Copy link
Contributor

davesnx commented May 23, 2020

Hey @johnhaley81

Could you share a repo where I can look into it?

Without digging much, The issue comes from importing a component that it's undefined instead of a fn. This usually happens when you have a bug in your import/export code. In this case, since it's compiled could you take a look at *.bs.js? (Those are always right, they return properly components and functions).

You can try to eliminate the error, inlining your component inside the story?

@davesnx
Copy link
Contributor

davesnx commented Sep 12, 2020

Hey @johnhaley81, did you solve the problem? Is there something that can we do?

@johnhaley81
Copy link
Author

Hey @davesnx, sorry for the late response, I'll try to get an example for you next week!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants