If I come from a world with React and JSON-API but then am working on a project that is vanilla Backbone.js and Twitter Bootstrap, what problems does React solve for me that I'm not aware of until I have to solve them in my current project? In other words, what complications of modern web-apps (like
First of all, how lucky you are that you get to work with The New Hotness most of the time!
To your question-- the most important thing about React is not the framework itself but the patterns, such as:
- Declarative over imperative views (i.e. your code is what the rendered component looks like, not step by step instructions for building it)
- One-way binding and data flow (data rolls downhill from parent to child only)
- Very little mutable shared state between components (avoiding joint custody/multiple write locations for objects)
- Composition over inheritance as the extension mechanism. DOM patching is right out.
You can implement the same patterns in other frameworks. ask.fm is bad for sharing code, but here are some rough ideas for your backbone case:
- Build on Backbone.View.render so each view doesn't do its own imperative DOM math. Make it so subclasses implement a declarative "template" method instead.
- Let Backbone.Component be composed-- i.e. should have a "children" attribute that represents components nested under this one. Expose that to the template.
- Don't pass data "up" from child views to parent views. Avoid upward communication when you can, and use events when you can't.
- Avoid using selectors anywhere in your code other than your default .render implementation.
To your question-- the most important thing about React is not the framework itself but the patterns, such as:
- Declarative over imperative views (i.e. your code is what the rendered component looks like, not step by step instructions for building it)
- One-way binding and data flow (data rolls downhill from parent to child only)
- Very little mutable shared state between components (avoiding joint custody/multiple write locations for objects)
- Composition over inheritance as the extension mechanism. DOM patching is right out.
You can implement the same patterns in other frameworks. ask.fm is bad for sharing code, but here are some rough ideas for your backbone case:
- Build on Backbone.View.render so each view doesn't do its own imperative DOM math. Make it so subclasses implement a declarative "template" method instead.
- Let Backbone.Component be composed-- i.e. should have a "children" attribute that represents components nested under this one. Expose that to the template.
- Don't pass data "up" from child views to parent views. Avoid upward communication when you can, and use events when you can't.
- Avoid using selectors anywhere in your code other than your default .render implementation.