rescript-lang / rescript-lang/rescript-lang.org

Confusion about binding to external React components

Open
#685 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
MDX
Stars
1.9k
Forks
260
Avg merge
3d 9h
Merged PRs (30d)
17

Description

The JSX 4 migration guide describes how it's possible to write components either writing the props type manually, or using the @react.component annotation.

However, when binding to external components, I found that the only valid way of defining the bindings is with the @react.component attribute, since otherwise rendering the component results in a runtime error. Please look at this playground example.

I'm not sure whether this is a bug, but if it's expected behavior, this should at least be documented somewhere. The question is where, though. The rescript-react docs used to have a section dedicated to binding to external components, but I seems like it's not there anymore.

If it's indeed a bug, I'd be happy to move this issue to the correct repo.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the JSX 4 migration guide and the rescript-react documentation section mentioned in the issue, then reproduce the behavior in the linked playground example. Determine whether external React bindings require @react.component or whether the example exposes a bug; done means the behavior is resolved or clearly documented in the appropriate guide.

Written by the indexing model from the issue text.

Assessment

Tech stack
react
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.