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

Unable to make a keyed fragment with JSX #293

Closed
MoOx opened this issue Nov 1, 2018 · 3 comments
Closed

Unable to make a keyed fragment with JSX #293

MoOx opened this issue Nov 1, 2018 · 3 comments

Comments

@MoOx
Copy link
Contributor

MoOx commented Nov 1, 2018

I am trying to use a keyed fragment, something you can do with reactjs.

I tried this

<ReasonReact.fragment key={"key"}> child </ReasonReact.fragment>

But I am getting

  We've found a bug for you!
  /Users/moox/Sync/Development/dame.bio/src/components/Comments.re 80:15-35

  78 ┆ ->Belt.List.mapWithIndex((index, comment) => {
  79 ┆     let isOwner = comment.author == 2;
  80 ┆     <ReasonReact.fragment key={string_of_int(comment.id)} >
  81 ┆       {index > 0 && comment.parent == 0 ? <Spacer /> : nothing}
  82 ┆       <View style=styles##comment>

  The module or file ReasonReact.fragment can't be found.
  - If it's a third-party dependency:
    - Did you list it in bsconfig.json?
    - Did you run `bsb` instead of `bsb -make-world`
      (latter builds third-parties)?
  - Did you include the file's directory in bsconfig.json?

>>>> Finish compiling(exit: 1)

Not that my IDE can resolve it (and I see it in the source too).

screenshot 2018-11-01 at 20 48 07

What am I missing with JSX?


Just in case, I am using reason-react 0.5.3 and <> </> works.

@maarekj
Copy link

maarekj commented Nov 2, 2018

Reason-react.fragment seems to be a value not a module.
Jsx accepts only module which contains a make function

@MoOx
Copy link
Contributor Author

MoOx commented Nov 2, 2018

@maarekj Just did a PR to add support for it :)
#295

@phated
Copy link
Contributor

phated commented Apr 25, 2019

@MoOx a Fragment component now exists in the React module! https://github.com/reasonml/reason-react/blob/master/src/React.re#L77

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

Successfully merging a pull request may close this issue.

4 participants