TarVK / model-react

A data model system to use with react hooks
https://tarvk.github.io/model-react/examples/build/
MIT License
13 stars 3 forks source link

backbone collections? #33

Closed jeacott1 closed 3 years ago

jeacott1 commented 3 years ago

Hi, library looks nice but feels very similar to backbone. is this going over similar ground? is it possible to just hook in backbone from your lib to provide an existing, solid collection model?

TarVK commented 3 years ago

I must say I am not very familiar with backbone, so can't answer with certainty. I would however be quite surprised it would work well together with backbone out of the box. Model-react is primarily intended as a set of (relatively) simple and flexible tools to bridge the gap between general OOP and react, while backbone appears to be quite a specific framework for OOP design.

To really answer your question I would need to get familiar with backbone first, but I unfortunately don't have the time for that. I recommend you have a quick look at the docs and see whether you're able to figure out if it would work together yourself :)

jeacott1 commented 3 years ago

Backbone has been around a long time, and has its faults for sure, but it's models/collections already handle these fetch/sync scenarios effortlessly. there are a few libs around that were primarily targeted at migration paths away from backbone/marionette to react, eg: https://github.com/magalhas/backbone-react-component. Almost every react project I see reinvents this stuff again and again, often poorly. When I saw your project I thought it looked like a step back toward embracing a more backbone-esq approach to model/sync management. When I saw the limitations of your fetch management atm I just wondered if it wasn't easier for you to lean on an existing lib than reinvent well trodden ground.

TarVK commented 3 years ago

Yup, seems fair enough. I am quite guilty of reinventing the wheel with my projects 😅 And my fetch/sync system is indeed rather limited. I mostly use model-react in projects where there is emphasis on a stand-alone state in the client, rather than where server and client state needs to be synchronized. It would definitely be nice to have more out of the box tools for that usecase in the future.

So just out of curiosity, if I (or someone else) would want to make a better backbone react library, what would that approximately look like? Or more specifically, what is backbone-react-component doing wrong that lead you to looking for other solutions?

jeacott1 commented 3 years ago

honestly not really sure. I don't think they are targeting a long lifespan for a start, and their integrations are probably pre-hook existing and not really targeting better, just a crutch. but I do feel a lot has been lost for no other reason than fashion.