For my dad, who both brought home my first hacked-together computer and proofread every paper that I wrote. I wouldnt be here without you. You are missed.
Foreword
In 1997 I was a junior in high school. A friend and I were goofingaround with the web-connected computer in our school library when heshowed me that you could click View Source to see the underlyingcode of a web page. A few days later, another friend showed me how topublish my own HTML. My mind was blown.
After that, I was hooked. I went around borrowing the bits of thewebsites I liked to construct my own Franken-site. I spent much of myfree time at the pieced-together computer in my familys dining roomtinkering away. I even wrote (OK, copied and pasted) my firstJavaScript, to implement hover styles on links, which was not yet doablewith simple CSS.
And in a turn of events that Ive come to think of as a nerdy andwholesome version of the film Almost Famous, my homegrown music sitegained reasonable popularity. Because of this, I received promotionalCDs in the mail and was put on the guest list at concerts. Moreimportant to me, however, was that I was sharing my interests with otherpeople around the world. I was a bored suburban teenager, in love withmusic, and was able to reach people Id never meet. That was, and stillis, such an empowering feeling.
Today, we can build powerful applications using only web technologies,but it can be daunting to get started. APIs are an invisible backgroundthat serves up data. View Source shows concatenated and minifiedcode. Authentication and security are mystifying. Putting all of thesethings together can be overwhelming. If were able to look beyond theseconfusing details, we may notice that the same technologies I wasfiddling with 20-some years ago can now be used to build powerful webapplications, code native mobile applications, create powerful desktopapplications, design 3D animations, and even program robots.
As an educator, Ive found that many of us learn best by building newthings, taking them apart, and adapting them for our own use cases.That is the goal of this book. If you know some HTML, CSS, andJavaScript but are unsure of how to take those components and build therobust applications that youve dreamed up, this book is for you. Illguide you through building an API that can power the user interfaces ofa web application, a native mobile application, and a desktopapplication. Most importantly, youll gain an understanding of how allof these pieces fit together so that you can build and create wonderfulthings.
I cant wait to see what you make.
Adam
Preface
The idea for this book came to me after writing my first Electron desktop application. Having made a career as a web developer, I was immediately smitten with the possibilities of using web technologies to build cross-platform applications. At the same time, React, React Native, and GraphQL were all taking off. I sought out resources to learn how all of these things fit together, but kept coming up short. This book represents the guide that I wished I had.
The ultimate goal of this book is to introduce the possibilities of using a single programming language, JavaScript, to build all sorts of applications.
Who This Book Is For
This book is for intermediate-level developers who have some experience with HTML, CSS, and JavaScript or ambitious beginners who are looking to learn the tools necessary to bootstrap a business or side project.
How This Book Is Organized
The book is designed to walk you through developing an example application for a variety of platforms. It can be broken down into the following sections:
guides you through setting up a JavaScript development environment.
Chapters cover building an API with Node, Express, MongoDB, and Apollo Server.
Chapters review the details of building cross-platform user interfaces using React, Apollo, and a variety of tools. Specifically:
introduces user interface development and React.
Chapters demonstrate how to build a web application with React, Apollo Client, and CSS-in-JS.
Chapters guide you through building simple Electron applications.
Chapters introduce using React Native and Expo to build mobile applications for iOS and Android.
Conventions Used in This Book
The following typographical conventions are used in this book:
ItalicIndicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.