Book Image

Rapid Application Development with AWS Amplify

By : Adrian Leung
Book Image

Rapid Application Development with AWS Amplify

By: Adrian Leung

Overview of this book

AWS Amplify is a modern toolkit that includes a command line interface (CLI); libraries for JS, iOS, and Android programming; UI component libraries for frameworks like React, Angular, and Vue.js for web development, and React Native and Flutter for mobile development. You'll begin by learning how to build AWS Amplify solutions with React and React Native with TypeScript from scratch, along with integrating it with existing solutions. This book will show you the fastest way to build a production-ready minimum viable product (MVP) within days instead of years. You'll also discover how to increase development speed without compromising on quality by adopting behavior-driven development (BDD) and Cypress for end-to-end test automation, as well as the Amplify build pipeline (DevOps or CI/CD pipeline) to ensure optimal quality throughout continuous test automation and continuous delivery. As you advance, you'll work with React to determine how to build progressive web apps (PWAs) with Amplify and React Native for cross-platform mobile apps. In addition to this, you'll find out how to set up a custom domain name for your new website and set up the AWS Amplify Admin UI for managing the content of your app effectively. By the end of this AWS book, you'll be able to build a full-stack AWS Amplify solution all by yourself.
Table of Contents (14 chapters)
1
Section 1: Getting Ready
4
Section 2: Building a Photo Sharing App
9
Section 3: Production Readiness

Adding the React Photo Picker UI component and Amplify Storage with ReactJS

In this section, we will learn how to add the Photo Picker UI component to the app, as well as the code that lets the user add a photo to the app through Amplify Storage. This will allow other users to see the photo through the app. Normally, we would need to write a lot of frontend and backend code to achieve this, but in this section, I will show you how to code in a minimal way. Let's get started:

  1. Let's open the App.css file and add the following CSS code so that we can style the Amplify S3 Image UI component at the bottom of the CSS file:
    amplify-s3-image {
      --width: 400px;
    }
  2. Open the App.tsx file and add the following code to it:
    import React, { useEffect, useState, SetStateAction } from "react";
    import "./App.css";
    import Amplify, { API, graphqlOperation, Storage } from "aws-amplify";
    import * as mutations from "./graphql/mutations&quot...