Build Design Systems With Penpot Components
Penpot's new component system for building scalable design systems, emphasizing designer-developer collaboration.

medium bookmark / Raindrop.io |
This series of posts will be the very first part of the âReact for Designersâ course Iâm creating. Be sure to sign up to receive exclusive updates!
In the previous post, we looked at what React is and what makes it special. Today letâs study React Native: what itâs for, where it came from, how itâs different from React and why itâs a big deal.
Iâll get you to come back here after reading this post. Hopefully youâll be able to answer these questions easily:
By now you probably have this picture in your head:
You see, React is a great tool for building user interfaces on the web. With React, you can build the UI by describing what you want instead of how to update the UI (reactive UI), organize the code in reusable components, and create performant UI without worrying about DOM the slowpoke (virtual DOM). More and more web developers choose React because it allows them to focus on a bigger picture instead of low-level details. We call this way of building the UI React paradigm. A paradigm is basically the way how you think about a problem and how you describe it and its solution.
Thatâs great for web apps. What about other platforms, such as iOS and Android? Wouldnât it be great if you could apply the same React paradigm to the development of mobile apps?
In a way, mobile platforms work in the same fashion as the Web. There is a model (a tree guy). There is something that creates visual elements according to the model (an artist). Not surprisingly, the traditional way of building a mobile UI is to directly manipulate the tree model and tell it how to update things (directly talk with the tree guy). This has similar shortcomings as directly working with the DOM in a web browser. React can definitely help on that.
Similarities aside, mobile platforms are different from the Web, and they are different from each other. In the past, developers had to learn the specific language and toolchain of a platform in order to build apps for it.
This is like working with exotic studios where the staff speak various different languages. Youâd have to learn all the new languages to communicate with those models. It doesnât sound easy, does it?
Therefore, if you wanted to build native apps for both iOS and Android, you had to create two completely separate codebases. The same business logic had to be implemented twice. It was difficult and expensive to create an app and even more so to maintain it in the long run.
That is why React Native was created. Letâs see how it makes things a lot easier.
For web apps, React takes care of enabling the React paradigm (managing reactive UI, components and virtual DOM), as well as actually updating the DOM in the browser (talking with Domo). When the DOM is the only thing it needs to interact, React can easily handle both tasks.
However, for mobile apps, things get challenging when itâs necessary to manage various tree models on different platforms. If we keep adding more responsibilities on Reactâs shoulders, itâll start driving our poor superhero crazy .
To deal with this, the creators of React split the original React into two parts. The first part is the new React which focuses on enabling the React paradigm. The second part is called ReactDOM, whose only job is to interact with DOM in the browser. Because ReactDOM updates DOM which determines what is rendered on the browser, we say ReactDOM is a renderer.
Back to our story, imagine that our superhero takes off his cloak and sprinkles some magic dust.
His cloak goes alive and becomes his helper. Freed from the burden of dealing with Domo, React can now concentrate on what he does the best.
This separation of roles is a powerful idea. It makes it easy to write new renderers that adapt to new platforms while maintaining a shared core. Powered by the renderers for iOS and Android, you can now build apps for both platforms in a single language and the same React paradigm.
React focuses on his thing. Renderers do the talk.
The official definition of React is: A JavaScript library for building user interfaces. Its meaning is twofold: first itâs a great tool for UI, second it doesnât include anything else.
In fact, you canât build a full application with just React alone. Youâd need for example CSS for styling, webpack for preprocessing and bundling the code, Firebase for persisting the data and many other things.
The studio âWeb Browserâ is actually a lot busier than what youâve seen.
This is fine in the context of web development because as a JavaScript library, React fits naturally with the other parts which are either JavaScript libraries too or are designed to work well with JavaScript libraries. After all, JavaScript is the language of the Web.
However, things are different for mobile platforms where various languages and technologies are in use. It becomes important to include a full package of tools that can be used in the same way as React, in JavaScript. Therefore, React Native was born.
Compared to React on the Web, React Native includes a lot more stuff:
We say React Native is a complete platform itself because it includes all you need to build a full app. In comparison, the original React is only in charge of web UI and youâll need to include other parts yourself to create a web app.
The formation of React Native
Have you ever wondered why React Native is labeled Native? Thatâs actually its branding feature: the UI built with React Native consists of native UI widgets that perform well and look/feel consistent, not some simulated crap wrapped in a WebView. The apps built with React Native are often indistinguishable from the apps written in native languages such as Swift and Java.
You know, those little things, such as scrolling acceleration, animations, keyboard behavior and drop shadows, actually play an important role in the user experience of your app. If those are not consistent with other apps on the phone, users will quickly get frustrated.
I originally intended to explain here what ânativeâ really means and why React Native performs better. But my notes quickly grew into a full page after a few brainstorming sessions. Letâs leave that as a future post of its own.
For now, I want you to just remember that native UI is one of the great things that make React Native shine.
So here you go, React Native is a complete platform that allows you to build truly native apps following React paradigm, in JavaScript.
Recently Airbnb recently released a nifty tool called React Sketch.app which converts React code into image layers in Sketch. Can you guess how it works?
Right! Itâs essentially React Native with a renderer who talks to the tree model in Sketch!
Because React Sketch.app is based on React Native, which is a full package, we can do fancy things like fetching data from a real API and rendering it in Sketch.
In the meantime, many other variations of React Native are created to support building apps for Windows, macOS, VR etc.
This means, as long as you master the essence of React, you can build apps for a gazillion of platforms (and counting), in JavaScript, with the same pattern of thinking. As
the creators of React Native nicely put, âlearn once, write anywhereâ.
So much talking so far! Do you want to try something on your phone?
Iâm excited too! Grab your phone and follow me!
Iâll explain this environment in detail in the future. For now, just remember that itâs like Codepen (the tool I used to show you the Domoâs hat example in the previous post) for React Native.
If you compare the React Native version of the code with the React (Web) version, youâll notice that they look very similar. They both go like this:
const Hat = ...
const Thinker = ...
// Below is the React Native version
// For Web version, replace "View" with "div"
const ThinkerWithHat = ({hat}) => (
<View>
<Thinker />
<Hat type={hat}/>
</View>
);
const HatSwitcher = ...
...
âLearn once, write anywhereâ! Remember?
You might have heard ReactJS (or React.js) a lot â and I used it too. In fact itâs never an official name . The official name has always been âReactâ since the day one.
Because JavaScript libraries tend to be named âXyzJSâ or âXyz.jsâ and React is a JavaScript library, perhaps people just appended âJSâ or â.jsâ to its name voluntarily. Since React was a library for the web in the beginning, many people use ReactJS or React.js to refer to React on the Web, the duo of React and ReactDOM.
Following the de facto convention, when I say ReactJS, I mean React on the Web too.
Awesome! Weâve gone over quite a few things so far. Weâve learned a bit of history of React and how React Native is put together. Being a complete platform, React Native includes everything that you need to build native apps in JavaScript and React paradigm. React Native now supports many platforms including iOS, Android, Windows, macOS, Sketch.app and even VR. âLearn once, write anywhereâ!
In the next post, weâll look at what a native app really is and why React Native is one of the best ways to build native apps.
I encourage you to go back to the Learning Goals to see if you can answer all the questions. Let me know if you have any questions or comments!
Want to learn more about React? Sign up now and receive exclusive updates!
I am fortunate to work with Beebee Ye, who is an excellent illustrator and storyteller. His illustrations have made these posts really unique and fun to read.
As usual, this post has gone through many edits. Whatâs special here though, is that Iâve almost completely rewritten the whole thing hearing that Iâve taken the metaphors too far.
I really appreciate your constructive suggestions that pushed me to rewrite it, Yitong Zhang, Brittany Smart, Grant Robinson, Jason Fuller and Victoria Pugh. Thanks a ton!
If you are curious, check out the previous version thatâs full of fantasy stories đđŠ đ.
Remember declarative and imperative programming? They are both paradigms. The React paradigm is about how to break down UI into components, how to pass data around etc., which weâll study in detail later. â©
In reality, itâd drive the maintainers of React crazy. â©
Well, the cloak is the only thing that I could think of can be split off from the superhero without any damage. Bear with me! â©
If you are looking for a in-depth technical comparison between React Native and React Web, check out this post. â©
The idea of React Renderers is very powerful. Here are a list of cool renderers that make it possible to build many different things with React. â©
In NPM, the central repository for JavaScript libraries, you can find both reactjs and react. Can you tell which one is the real React? â©
AI-driven updates, curated by humans and hand-edited for the Prototypr community