45
• Views are automatically updated any time their state changes. This
is
termed a reactive interface, and it essentially means that when
the data the interface deals with changes, the interface will update
appropriately to reflect it, all without the developer having to write
code to do so explicitly.
• High performance is a key consideration right from the start. While
FaxJs achieved this in large part thanks
to a string concatenation
approach, React instead uses something a little more robust: virtual
DOM. I’ll come back to this in the next section.
• Perhaps most importantly, FaxJs at a high level was based on the
notion of components. Everything you did was a component, and then
you composed these components into the interface seen by the user.
Possibly the big turning point in the history of React was in 2012 when Facebook
started running into a lot of problems managing the ads displayed on the site. Since
ads usually are served by someone else’s server and you aren’t
in complete control of
what they are, it’s easy for them to break your site. So, the engineers at Facebook started
looking for a solution, and FaxJs jumped out at them.
At that point, Jordan Walke started working on an initial prototype and, before long,
React emerged.
But just creating React and even using it internally wouldn’t
have changed the
world even if it helped Facebook tremendously. No, something else had to happen,
and that something else was in April of 2012 when Facebook acquired Instagram. This
was important because Instagram wanted to use React, but at that point the library was
tightly coupled, relatively speaking, to Facebook’s site itself and its code. And, of course,
it was entirely internal for Facebook and maintained by,
for the most part, one (brilliant)
person. No, if Facebook was going to let others, even a new acquisition, start to use
React, they would have to open source it, and they would have to build a community
around it to continue driving the ball down the field.
The primary driving force of this shift was a guy named Pete Hunt. Pete, along with
Jordan, got React open sourced in May of 2013.
Interestingly, at its initial release, there
was a lot of skepticism about React and many people, for various reasons, saw it as a bit
of a step backward. It didn’t take long, however, for the momentum
to shift as people got
a better look and some experience with it, and by the end of 2013, things were looking a
lot better for React.
Chapter 3 Client-Side adventureS: reaCt
46
During 2014, several things occurred to shift the currents in React’s favor. For
example, React Developer Tools were released as an extension of Chrome Developer
Tools, giving React developers a robust development toolset to use to develop and debug
their React apps. A significant number of conferences and meetups were held to expand
exposure to React. Many editors and IDEs begin to introduce native support for React.
All of this began to take React mainstream.
2015 and 2016 are when it
really started to go mainstream. Flipboard, Netflix, and
Airbnb all using React most definitely helped a lot. Many
more conferences and the
release of more robust React tooling did too.
Since the end of 2017, React has continued to grow and is now one of, if not
the, most
popular library for building client-side web applications.
Note i keep emphasizing the client-side nature of react, and that’s primarily
because that’s how we’re going to use it in this book. But it’s worth noting that
react can also render content on the server side. that’s a whole other topic of
conversation that i won’t be covering in this book, but i wanted
to make you aware
of it. Should you wish to Google for it, the somewhat obvious term applied to this
is Server-Side rendering, or SSr. it’s not
exclusive to react, but react makes it
considerably better.
Do'stlaringiz bilan baham: