How to use MobX without React? #3396
-
I'm looking for guides, but it's hard to find something without React involved. The reason is I have to deal with a Laravel application that uses no UI framework and not state management at the moment. Refactoring the whole application is not acceptable giving the amount of time it would take, but a who step transition seems most logical to me. I want to start slowly moving the global window objects into a state management, thus I'm looking for a library like MobX, that will work with any framework, even with vanilla JS. How to I write observers so they update HTML elements manually in the DOM, correctly? I would enjoy a full fledged guide on using MobX with vanilla JS. Best I found so far is this article. It comes with a few samples, but lacks the overall picture, there is no example repository to explore, a proper guide would be superior for me. I want to emphasize that we have not decided which UI framework we will implement in the app in the future, there is a lot to discuss and to evaluate. Although, the missing state management is a crucial problem and needs to be tackled asap. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I'd take a look at lit-html. It's good, very light and iirc they have good
mobx integration
…On Sun, 15 May 2022, 14:21 Martin Braun, ***@***.***> wrote:
I'm looking for guides, but it's hard to find something without React
involved.
The reason is I have to deal with a Laravel application that uses no UI
framework and not state management at the moment. Refactoring the whole
application is not acceptable giving the amount of time it would take, but
a who step transition seems most logical to me. I want to start slowly
moving the global window objects into a state management, thus I'm looking
for a library like MobX, that will work with any framework, even with
vanilla JS.
How to I write observers so they update HTML elements manually in the DOM,
correctly? I would enjoy a full fledged guide on using MobX with vanilla JS.
I want to emphasize that we have not decided which UI framework we will
implement in the app in the future, there is a lot to discuss and to
evaluate. Although, the missing state management is a crucial problem and
needs to be tackled asap.
Thank you.
—
Reply to this email directly, view it on GitHub
<#3396>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBFGHUDRC43OBLUKZFLVKD24TANCNFSM5V7C2IDQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Laravel has built-in integration with React / Vue that's why I'd choose them: https://laravel.com/docs/7.x/frontend Here is an example how to use |
Beta Was this translation helpful? Give feedback.
Laravel has built-in integration with React / Vue that's why I'd choose them: https://laravel.com/docs/7.x/frontend
Mobx has integrations with both React and Vue.
Here is an example how to use
autorun
to manually update DOM when observable data changes: https://jsfiddle.net/Lrt9pky4/But if you want something automatic you should implement your own
observer
. Essentially it isautorun(() => component.rerender())
but you probably end up building a library to cover all the edge cases. It is up to you to decide if it's worth it.