3 ms·
I've thought about this alot. I know how to protect my backend from frameworks and to make the framework/database a detail, but how do I do this for front end a
by vips7L 6y ago
I've thought about this alot. I know how to protect my backend from frameworks and to make the framework/database a detail, but how do I do this for front end applications? Especially when things like React abandon the dom/web platform.
- dntrkv 6y agoYou can't avoid that when using a framework, since the main differentiation between a library and framework is inversion of control. Writing some kind of abstraction on top of the framework is a pointless endeavor since at the end of the day, all of your code will be structured in a way that adheres to the contract defined by that framework. Databases don't dictate the structure of your entire application like a framework does, so that comparison is not useful.
- tracker1 6y agoReact isn't really a framework, though it's very close and a pretty flushed out DOM abstraction. I'm not really sure what you're trying to "protect" from React in this case? It renders what you tell it to. From a component perspective, whatever the output of your component is, that's what gets rendered/updated on screen. There are a few escape hatches in place, depending on what you're trying to do though. From TFA examples, when faced with similar issues (though not quite the same), I found directly writing SVG markup over a document background to be extremely straight forward with React. For the most part, the problem you are describing is when you are actively trying to NOT use the tool you're using. I've been developing web based applications since the mid 90's and React is hands down the best tool I've used in that timeframe for web applications. That said, if you're mostly delivering static content, then it may not be the best fit. In those cases using something like Vue, or another option for enhancements (even jQuery-like) may be a better option. If you're going to use React, you are best off understanding and embracing it... if you aren't, then don't use it. I don't intend to be mean, it just seems your perspective is off. It's much like asking how you use a SQL oriented database without the inconvenience of SQL or data types.