woonki
woonki
> However it compilers perfectly fine with V4 because there's no `makeProps` generated. It looks really cool. It is due to making the props type as polymorphic and using the...
Thank you for raising the `key` issue. ~~I think this example shows what we need to fix. We don't need to pass the `key` in the props record. I believe...
> is it OK to pass key to a component that does not expect it? For normal props, that's an error. I think it should be down to the component...
> My proposal is to explore using key as follows: > > ```rescript > @react.componet > let make = (~key=?, ~a) => {React.string(a)} > ``` > > If your component...
The prop `key` is special in Reac.js. No need to be defined, but all components have it.
Ah.. I think I got your point and what you're solving. If I understand correctly, I think you're pointing `1` expression. ```rescript module Bar = { type props make(props) //...
And all react components have the `key` prop basically, having a `key` field in the props type seems natural.
FYI, here is the js runtime representation after being transpiled. ```js function Interesting$Bar(props) { return props.x; } var Bar = { make: Interesting$Bar }; function Interesting$Foo(props) { return React.createElement(Interesting$Bar, {...
> The only reason to have it in the type is a technicality. > > You could have `addKey : ('a, string) => 'a` use that and avoid putting `key`...
> It's because of the surprise effect and the boilerplate. > > If I want to write a component directly, I need to define the key thing for every component....