Skip to content

Commit 7e1660c

Browse files
Add notice to the docs
1 parent d248857 commit 7e1660c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/pages/docs/reflect.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,23 @@ In most cases your callbacks will be synchronous and you will not need to do any
115115
#### Special case: Asynchronous callbacks
116116

117117
Asynchronous callbacks are also allowed, but those should follow the rules of [Imperative Effect calls with Scope](https://effector.dev/en/api/effector/scope/) to be compatible.
118+
119+
## TypeScript and Polymorphic Types Caveat
120+
121+
Generally, reflect handles polymorphic props well.
122+
However, in some implementations, such as [Mantine UI](https://mantine.dev/guides/polymorphic/), it may not work as expected.
123+
124+
In such cases, it is recommended to explicitly narrow the component type. For example:
125+
126+
```ts
127+
const ReflectedMantineButton = reflect({
128+
view: MantineButton<'button'>, // <- notice explicit component type in the "<...>" brackets
129+
bind: {
130+
children: 'foo',
131+
onClick: (e) => {
132+
clicked(e.clientX);
133+
},
134+
},
135+
});
136+
```
137+

0 commit comments

Comments
 (0)