-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
How one can wrap ALL external components in observer without recompilation? #1107
Comments
The basic idea is not to make external components |
This is the default pattern wherever possible. But this is about rendering Table. It can contain decent amount of data. I really do not want to rerender whole table when single data row changes. |
Firstly you can't make an element observer, but a component. You can't "hook into" If you can provide a custom <Column render={(text, record) => <Observer>{() => { /* dereference observable object here, like record.text */ }}</Observer>}> EDIT: Btw it's the library, which doesn't have means to perform a "partial" component update. Or is there any non-MobX solution which allows that? |
I've tried
The idea here is that i need generic column for showing some property from objects. |
Well |
Ok, here's more code to clarify
Here we have 2 components. In The trick here is that the first column is now bound to observable item but the generic one it not and it is not rerender after editing record.Name. If you can point to solution here, i would really appreciate. |
@stgolem either use the non generic one (or express the generic one with in terms of the non generic one, with help of I would recommend the first approach. We can't do much more for you. If the data is observable, but the data consumer isn't based on MobX, there is simply no way we can still super magically give all the benefits of mobx to that non-mobx aware consumer. |
We all have to read #101 here, but whats next?
Can anyone please provide me an example of using mobx with big 3-rd party components library like https://github.com/ant-design/ant-design?
We are stuck with Table and all its nested components. Here is basic example:
As you can see here we have Table and Column that is bound to dataIndex by property name. To make it work we have to recompile whole ant-design project, that have references on more internal https://github.com/react-component components (we have to mark them ALL as observer also).
That is... a lot of unpaid work we have to to ((
How one can wrap ALL external components in observer without recompilation?
Isn't it confusing and misleading with whole MobX concept?
Can we remove this limitation from our mobx sources?
The text was updated successfully, but these errors were encountered: