My Reaction to React
21–30 of 147 posts
Re: My Reaction to React
#22Earlier quoted context omitted.
Yes and no. Homerolled solutions such as this are free of another developers assumptions, but tend to scale poorly. Generally they need to be modified as new requirements are created, or unforeseen circumstances arise. Over time you end up putting together more and more logic in and the illogical conclusion is that you end up building your own heavily bespoke version of React/Angular/jQuery/whatever, before realising…
You are absolutely right, but I do believe people should start learning the alphabet before trying to read a book. React looks fine to me and at my daily job our frontend devs do some amazing job. I just wanted to learn and all I seem to find is how to learn javascript through React, and not React through Javascript. I do agree this is a home made solution and would not work nicely with lots of devs involved. I'm tal…
jQuery, sure, that's probably harmful in the long run, but you have to know JavaScript to use React.
/Structuring/ an app is a different skill that takes lots of consideration, especially in a language as flexible as JavaScript.
Re: My Reaction to React
#23I very much enjoyed reading this one. Though I always find it more beginner friendly to start off with a framework rather than going vanilla. That goes for almost all subjects in tech. Then you can dive deeper into the material once you have a basic understanding.
Here is a link to the original article: https://medium.com/learning-new-stuff/building-your-first-re...
Re: My Reaction to React
#24So I recommend the author learn minimalistic libraries like Riot instead of React. Those are really lightweight and very easy to grasp. However, even the docs of Riot could still be improved. Despite its simplicity, I could have learned it in half the time if it had a better tutorial.
Essentially, this means applying findings from UI design to framework API design. Here, the user is a developer, but surprisingly many principles still hold: Principle of least surprise, make similar things look similar, make different things clearly different, and so on.
Re: My Reaction to React
#25I went down a similar path a few years ago when starting a new project. Instead of learning a new framework I wrote my own. It took less time overall, since the logic wasn't especially hard to write, and it was easier to debug - at first. Everything changed as soon as another developer, then two, then three, started working on it with me. They were not happy about learning how to use my custom MVC framework. Perhaps…
Re: My Reaction to React
#26React is just a library. It is the ideas behind it that are important: a) building web front-ends by dividing them into components which are first-class citizens of the codebase, and can be composed, parameterized and reused, just like pure functions. [1] b) expressing the view as a pure function of state has replaced any need to mutate the DOM manually and think about transitions ($.remove(), $.append() etc.). We ne…
There is no 'one true way'; as long as your app works and you can hold it in your head, everything is fine. With all due respect, this is the major criticism of adopting React, given that it's still in active development and given that many who are looking at using it have established apps using other patterns already.
You can use React's immutability helpers inside it, or or performance in large state trees, use ImmutableJS that gives persistent immutable data-structures. This comes at the cost of having to use its own methods like map and filter, instead of normal JS everywhere.
But that is pretty much it. There are a few more other concerns that'll necessitate the use of redux-thunk, (which at its core is a few lines long), but you don't need to worry about any of this upfront. The thing with React is that unless you make costly architectural decisions upfront, you can always learn as you build, and figure out the right way to structure your project. Once you've built a fairly large project, you'll form your own set of opinions on which way you like to think about front-end code, and that'll inform you on your next project.
There is a learning curve, but with React, you are always thinking about fundamental things like encapsulation and message-passing than trying to learn non-transferable knowledge about a particular framework's quirks and conventions.
Re: My Reaction to React
#27Re: My Reaction to React
#28Re: My Reaction to React
#29Okay I think the author is severely misinformed as to why we use React. I say this because the very first thing he says is to use MVC architecture and then goes on to write his own framework ( from scratch??????? ) ...Why? This solves none of the problems React was designed to solve and only makes things more complicated by introducing new APIs only you know. Yes, this approach with vanilla JS is great for small apps…
I'm not really fighting you on the merits of frameworks (which should be obvious to everyone), but are you implying that implementing a design pattern is equivalent to building a framework?
Re: My Reaction to React
#30 var App = {
main: (function() {
window.addEventListener('load', function() {
// ... initialization ...
});
})()
};
The initialization code is with an event handler function, fine. But then:- Then registering of that event handler is stuffed into a closure, although it doesn't declare any variables or pollutes the global namespace in any way.
- This closure is then called immediately and its return value is stored into App.main, although it doesn't return anything, so App.main is declared as "undefined".
So there are two layers around that code which serve no purpose at all. Why not simplifying it? All you want is an App namespace and an event handler for window / load:
var App = {};
window.addEventListener('load', function() {
// ... initialization ...
});
Or, if you want a "real" main function (i.e. an "App.main" that is actually a function): var App = {
main: function() {
// ... initialization ...
}
};
window.addEventListener('load', App.main)
If you put your tags within , right before , you could simplify this further to: var App = {
main: function() {
// ... initialization ...
}
};
App.main();