Closed jamescostian closed 6 years ago
This is interesting. I'll have a think about it.
But I feel what I'm getting at here is "less code / more simplicity" than MVC.
So just the HTML + replaced values (templates) + event listeners
and then a bunch of functions in the same scope that handle everything.
I actually don't think anything more is required to build complex SPAs. I think React and others are solving problems that don't exist for most situations and costing a lot of extra bloat in the process.
I've heard that React is simply a recruiting tool for FB and a way for them to solve a 5000+ team working on the same codebase (meaning, I think, that the high level of opinionation forces consistency). This is obviously great for them, but I don't think this is required in other scenarios. And I personally don't want to be bound by "someone else's opinions" of how I ought to think/work. Which may work for them. But just by the same rationale, I'm a fan of picking the exactly right tool for the job/the team.
Also, even if FB's exact approach is required always, React is only once instantiation of how to achieve that.
With Brutal.js, I'm exploring alternatives.
But I will have a serious think about what you say, there is no doubt ways that my model of doing web apps / alternative to MVC can be improved and clarified.
If you have any ideas or suggestions/contributions implementing my model / or the more conventional MVC model, I really happy to have your PR again. Thanks for your help last time! I really appreciated it @jamescostian 😸 and I look forward to seeing anything else you can do for this!
Closing because I've decided to use stateless components only.
If you're interested in the experimentation I did, take a look at : https://github.com/dosyago-coder-0/brutal.js/pull/7/files/043be3e2708b38775f0d4438e2cac0714c80be40
If you look at the React version of TodoMVC, you'll notice that they create components and then they use them - e.g. App uses TodoItem directly. Each of the components are also self-sufficient.
But in this repo, components are nested by mounting them manually instead of declaratively stating where they should be. In addition, there isn't any separation of the controller or view code from the model, which leads to component functions directly talking to the model - e.g. notice how many times
updateList()
is called. The React TodoMVC shows an example of how a model should be made