Conversation
src/React.res
Outdated
| [Read more on the React Documentation](https://react.dev/reference/react/Activity) | ||
| */ | ||
| module Activity = { | ||
| type mode = [#visible | #hidden] |
There was a problem hiding this comment.
I wonder if we shouldn't rather do
type mode =
| @as("visible") Visible
| @as("hidden") Hidden
?
I know that's not how we did it for domProps and also not for the React Native bindings, but I think that was because @as for variant constructors was not available at the time of their writing.
In general, these days I would only use polymorphic variants instead of normal variants when there is a good reason to do so.
One example for use of normal variants everywhere are the rescript-mui bindings.
There was a problem hiding this comment.
Ok I made the change.
But I'm curious now : what's the good reason to use polyvariants ? 😄
There was a problem hiding this comment.
But I'm curious now : what's the good reason to use polyvariants ? 😄
Composable error handling for example.
There was some post about this for ReScript, cannot find it right now.
Here is an article about that for OCaml: https://keleshev.com/composable-error-handling-in-ocaml
Most of the APIs described on the changelog
<Activity>useEffectEventcacheSignal=> I don't plan to do it on this PR, because other RSC stuffs are missing