298 points · by DimitriMikadze · 8y ago · 102 comments
Also, the Reactiflux chat channels on Discord [2] are a great place to get help and learn. We've always got a bunch of people hanging out happy to answer questions. Come on by and join us!
[0] http://blog.isquaredsoftware.com/2017/12/blogged-answers-lea...
And honestly -- React doesn't have the same pain points jQuery/Backbone/Angular1 did where I couldn't wait to move on after 6 months. We'd have to see an absolutely massive paradigm shift before I'd regret writing my apps in React.
- The core language has gotten a lot better with ES5+ features. Async, fetch promises, etc., are all now built-ins on modern browsers, and have learned lessons from the pain points the initial implementations in libraries like jQuery.
- React itself is only a view layer with minimal concern about the form of your data -- you can use an array of other libraries on top of it to help with shared states, network requests, etc.
Will someone come along and do a view layer better than React? Probably. Will it be as big of a leap as what we've seen over the past few years with ES5/6/7 & React? I don't think so.
Standard redux is just too low-level.
Take a look at Mobx State Tree https://github.com/mobxjs/mobx-state-tree
Context API: https://reactjs.org/docs/context.html
Unstated: https://github.com/jamiebuilds/unstated
This eliminates almost all boilerplate-ish code compared to redux, but it comes with its own caveats. I think it's a solid choice for small to medium size applications.
It supports full typescript typing, and uses Immer to allow very direct store updates with immutability.
Imagine for every 10 components you pull you'd load 10 separate frameworks - unless they all come from the same source. These "components" wouldn't be able to know one another or work together at all. The only thing web components are good for are encapsulated styles, but that hasn't been a problem for many years now.
Since they've come up with the idea the web has moved on. React has progressed to such an extent that javascript has effectively left the browser, drives full-native applications, renders on the server, makes interop possible that no piece of technology has been able to pull off before, where you can share code and semantics on pretty much every platform while being able to re-use eco system components: https://news.ycombinator.com/item?id=16198843 and https://github.com/gaearon/react-blessed-hot-motion
Throwing all this away, we'd be back in a browser-tied web driven by dumb-components, and for no reason at all.
Web components are the dream of sharing code widely across many different systems, just like HTML, CSS and JS do. This is why it will beat React in the long term, wrapped in a lighter weight set of frameworks.
Just the other day there was an article discussing how the virtual dom could be improved with a static dom, and then only partially updated at the edges, something React isn't even designed to do. (ie, it does a complete diff of the dom and manages the entire view, correct me if I am wrong here)
Finally, if performance is your game, browser optimized code, whether it's web assembly or simple improvements to components, it will always beat a virtualized layer on top of it. Again, React will lose on this point too.
The question is, how long will it take before there truly is something better widely available? Or is it here already and we can't see it's value yet?
It is a Rich Harris project (authored Rollup, Ractive, Bublé) so might be worth paying attention to.
Those fundamentals are useful everywhere, like backend event-sourcing, CQRS, message-driven actor systems, and even all of the other libraries like Vue, Angular, etc. Learning any of these is like learning 80% of the rest.
Also React has some of the best release and upgrade notes along with tooling so that you can take an app through versions very easily.
I've been using it the past 6 weeks and super happy with it. I'm sticking with the hyperscript form of it, but you can use JSX if you want.
With snapshots, while not perfect, they do catch a lot and are easy to do (and more importantly, easy to update when things change). React components are relatively easy to further test with enzyme and jest.
Without a focus on instructing people how to do testing, people never bother.
React, with it’s declarative approach, stateless components, immutable state, etc. seems purpose-built for testability. TDD with React should be ridiculously easy, but I wouldn’t know, because no one seems to want to talk about it.
I hope that more people building the learning courses will focus on that. If I had time, I'd do one myself, as I now heavily test all my React stuff. I refuse to build another webapp without proper automated unit testing. It catches so much stuff.
The first examples are better off with just using snapshots. Even if the author is trying to explain the concepts, it is really poor to show bad examples that could be covered by a simpler solution. If I read that and didn't know about snapshots, I'd think to myself, "why am I testing strings?" and then skip testing entirely.
Mocking Axios also seems like the wrong way to approach things. I'd extract the networking code from the presentation code. Possibly by using mobx-state-tree (which is an epic solution to a hard problem). This way, I wouldn't even need to mock Axios at all and I could then just take advantage of snapshots again by providing actual mock data to my components directly.
2. Are there any live coding walk-through tutorials of real world projects/examples, that helps you get complete understanding of development process?
By watching professionals in action, we can learn a lot from them, such as best practices, thought process, handling issues and problems and much more.
1. I would like to know, if there are any such "free" tutorials related to web development, which are short and in-depth, and covers a breadth and depth of knowledge.
2. Are there any live coding walk-through tutorials of real world projects/examples, that helps you get complete understanding of development process?
By watching professionals in action, we can learn a lot from them, such as best practices, thought process, handling issues and problems and much more.
https://github.com/alexkrolick/react-lib-quickstart
Want to port this to a CLI eventually, too
Most React apps have no animations whatsoever (including mine, because I have no idea how to implement them), but they're important for usability IMHO.
I absolutely have to look into this soon.
Implementation will look something like <TransitionGroupRoutes><CSSTransitionRoute path="..."/><CSSTransitionRoute path="..."/></TransitionGroupRoutes>
I'll check it out, though! If you have a mailing list feel feel to add me: me@nbrogi.com
:-)
EDIT: I think your comment below is too deeply nested and it doesn't let me reply. However: I think a mailing list is useful even for personal project. In the event that the project gets traction, it would allow you/motivate you to keep working on it and improve it (I'm a professional side project creator).
As for nested animations, it might make sense to chain them..? Not sure.
This uncovered a new problem for nested animations. The high-level page transition animation occurs even when the url root does not change. So I need to be able to ignore animations on Route components located high in the VirtualDOM, and apply animations (sometimes different animations) on Route components located further down.
Maybe you already know of an elegant solution to solve this problem? If so let me know! In the meantime, I'll keep bang'n on this.
Edit:
Concerning giving an indication that a panel has been opened, I'd just use CSSTransition wrapped around whatever element that is going to be introduced to show that it has been opened. Then define your 'enter' animation in css.
If that seems like overkill, and you can't use did mount to determine if the animation should be applied, then I'd just add a css className to your element to introduce some animation defined in CSS.
Obviously, I may be misunderstanding your use cases here. The above are just knee-jerk thoughts on it.
The problem I'm aiming to solve is nested route animations, and allowing for different animations to be applied depending upon the previous route in history.
Perhaps providing hooks to override the behavior, but even not.