Earlier quoted context omitted.
But that's great until it isn't. You can design all the declarative things you want, but someone will eventually come up with a requirement that doesn't appear to fit a declarative structure, such as an event that fires 2 seconds after something else happens. And so to resolve that you can construct state machines with transition states to get back to a declarative model, but those state machines can quickly become a…
I can call ‘setTimeout’ from the component? I honestly don’t see the issue with your example. I’d use an event handler to work out when something happened. This would set the timeout, and the handle would be stored as a ref. I’d have a use effect hook to clean up the timer, so when the component is unmounted the timeout is cleared. What’s the issue here?
What I wish I knew about React
171–180 of 301 posts
Re: What I wish I knew about React
#172I am not so up to date with frontend dev but what's with the hate towards React these days? It still does what it's supposed to do very well and very fast. Yeah sure if you want JSX you need transpilation but I would want that anyway if I want any of the ES6 features without losing browser compatibility. And it's also constantly evolving and getting better. Just recently I started a React project with class component…
Re: What I wish I knew about React
#173Earlier quoted context omitted.
But what's so hard/bad? Literally zero config and two commands: npm install -g parcel-bundler parcel ./index.html
It adds complexity. Software rots faster. You are more likely to git clone a 7 year old front end project and be able to run it successfully than a 7 month old project. It’s hard to find projects that successfully pin versions down so that you can build them after regular work on them has stopped.
Re: What I wish I knew about React
#174I write a lot of enterprise apps and I’ve seen many many frameworks come and go over the years. I personally am not impressed with React and don’t get what all the fuss is about. We’ve had Angular, jQuery and a whole bunch of stuff over the years and each one managed to become a ‘a thing’ for a while
I come from a game development background, and there we had Immediate GUI's for some time now (https://eliasdaler.wordpress.com/2016/05/31/imgui-sfml-tutor...). React basically translates this concept to the web, and does some optimizations to not rebuild the entire DOM from scratch, and only rebuild when state changes and not every frame.
Writing a 'render function' is simpler and easier than building a structure of widgets and letting them handle events. (I like simple and easy)
Anyway, it seems both react and flutter are also gaining on the mobile apps developments, and web developers are very happy using React.
Of course frameworks come and go, but React introduced a shift of mind when programming GUI's.
Re: What I wish I knew about React
#175Aren’t hooks more confusing than the class components? In a class, you write your initialization code in the constructor - no infinite loop if you fetch something. And anyone who has used classes in Java or other languages would feel at home.
Re: What I wish I knew about React
#176Earlier quoted context omitted.
I personally find “the HTML is a function of its inputs, internal state, and nothing else” to be a much more predictable model for writing large web applications than, “anybody anywhere in your code can pull the rug from under you arbitrarily with jQuery”, and for that alone I prefer the React development experience. With Hooks I’m happy in that most of the “business logicky” stuff can be split out into those and my…
> I personally find “the HTML is a function of its inputs, internal state, and nothing else” to be a much more predictable model for writing large web applications than, “anybody anywhere in your code can pull the rug from under you arbitrarily with jQuery”, and for that alone I prefer the React development experience. Respectfully, that's not at all what HTML is supposed to be, but even so, as it turns out, sometime…
Re: What I wish I knew about React
#177Earlier quoted context omitted.
I've been coding and training people in react for a while now, and here is my experience: - if you learned react by yourself years ago, you had to go through a lot of pain: the doc was terrible, the ecosystem a moving flaky target and conventions were not established. Things are better today, but it's not something you forget. Somebody starting react in 2018, and with create-react-app, will feel much happier. - if yo…
React native code re-use is possible just not in the way people imagined. You can reuse your Redux code, you can reuse higher order components you just can't reuse the atomic UI elements. React native performance is good too it just doesn't come for free. You need to know how to do native animations and you need to do late binding and all the other performance optimisations you should be doing with React anyway. The…
I've found RN performance passable but underwhelming. It seems generally worse than a good native UI, and no better than a mobile web UI.
I don't understand why the JS is run in a separate thread, rather than just using the UI thread for UI (as it's intended for). By making all the interaction with the native toolkit asynchronous, it adds extra latency and leads to unavoidable glitches in native widgets used as controlled components.
Animation in React Native is much more of a hassle than UIKit or even CSS. (About the same as native Android, though, where it's also pretty tedious.)
Re: What I wish I knew about React
#178Earlier quoted context omitted.
Yeah but how is that different from any other UI framework? onCreate/onStart/onResume and onComponentDidMount, onPause/onStop/onDestroy and onComponentWillUnmount are basically the same. Be it Android, Swing, or Qt, everywhere it's the same pattern. React is the first framework which actually feels like UI development on the web, not anymore like JS spaghetti. In fact, having internal state, externally given props, e…
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... > JavaScript classes, introduced in ECMAScript 2015, are primarily syntactical sugar over JavaScript's existing prototype-based inheritance. The class syntax does not introduce a new object-oriented inheritance model to JavaScript. You've been tricked into thinking you're using a class, but you're really not. I understand it's a useful trick, but hooks a…
It may be technically correct, but C++ and now JS have a "class" keyword for a reason, and that's to steer you towards organising your code into classes which operate in certain ways. In both languages you can avoid using classes, sure, or abuse classes in various ways. But fundamentally they do have classes.
Re: What I wish I knew about React
#179I write a lot of enterprise apps and I’ve seen many many frameworks come and go over the years. I personally am not impressed with React and don’t get what all the fuss is about. We’ve had Angular, jQuery and a whole bunch of stuff over the years and each one managed to become a ‘a thing’ for a while
You declare how your view looks like, wire up the state and user interaction stuff and you have a self contained puece of code.
People doing UI stuff, before the advent of React usually highly appreciate it because they know how much work it takes to actually build a usable UI in vanilla JS.
Re: What I wish I knew about React
#180I write a lot of enterprise apps and I’ve seen many many frameworks come and go over the years. I personally am not impressed with React and don’t get what all the fuss is about. We’ve had Angular, jQuery and a whole bunch of stuff over the years and each one managed to become a ‘a thing’ for a while
React introduced a whole new way of writing GUI's. I come from a game development background, and there we had Immediate GUI's for some time now ( https://eliasdaler.wordpress.com/2016/05/31/imgui-sfml-tutor... ). React basically translates this concept to the web, and does some optimizations to not rebuild the entire DOM from scratch, and only rebuild when state changes and not every frame. Writing a 'render functio…
What will happen to this way when React is "outroduced" ?