Design+Code logo

Quick links

Suggested search

What you'll build

This is a preview of the final result: https://advancedreacthooksmaster.gatsbyjs.io/.

Screen Shot 2021-06-15 at 10.29.22 AM

Recommendation

I highly recommend starting your coding journey with Build a web app with React Hooks.

dc-web

Figma Design System

Similar to the Build a web app with React Hooks course, the design file was created in Figma, and you can download it to see how the design system works.

React Hooks

In addition to making React easier, you can add Hooks to it, so you can easily manage your component's state and lifecycle. For instance, you can import the useState hook and handle the state of your component. Learn more.

Screen Shot 2021-06-30 at 4.40.46 PM

const [state, setState] = useState(initialValue)

Framework

With Gatsby, you can create static content-driven websites. It takes care of all the configuration for you. Complex websites can also be built with Gatsby - for example, the current Design+Code website. Gatsby is known for its outstanding search engine optimization, performance, scalability, accessibility, and security. Learn more.

Screen Shot 2021-06-30 at 4.43.19 PM

Install NodeJS

NodeJS needs to be installed in order to run all Javascript libraries, including Gatsby, Styled Components, and React.

Screen Shot 2021-06-30 at 4.44.38 PM

Install VSCode Editor

Coding requires the use of a code editor and Visual Studio Code is one of the most popular one. This code editor has the advantage of being lightning fast, supporting hundreds of languages, code snippets and extensions eco-systems.

Screen Shot 2021-06-30 at 4.44.12 PM

VSCode extensions

  • VS Code ES7 React/Redux/React-Native/JS snippets
  • VSCode GraphQL
  • Node npm
  • Path Autocomplete for Visual Studio Code
  • Prettier Formatter for Visual Studio Code
  • vscode-styled-components

Installing Gatsby

Gatsby must be downloaded via NodeJS. Open your build-in terminal.

npm install -g gatsby-cli

Screen Shot 2021-06-30 at 4.51.45 PM

*If you have an error while installing the gatsby-cli, use this command instead and enter your password.

sudo npm install -g gatsby-cli

Gatsby project

Let's create the project now. The project will be saved in your downloads folder.

cd Downloads
gatsby new advancedHooks

Preview your app

Open your new folder in VSCode by dragging and dropping in your dock. Use the integrated terminal with CTRL+` and start your environment locally.

gatsby develop

By clicking on the http://localhost:8000, it will open a web browser link and display your site.

Screen Shot 2021-06-30 at 5.10.26 PM

Site architecture

  • Src (source) is a folder that contains components and pages. Every reusable component in your project goes into the components folder such as buttons, cards, animations, rows, lists ...
  • Pages, a new page will be created automatically for each file. Pricing.tsx, for example, will route to /pricing. Only index.tsx will route to the main page.
  • Static folder contains all your assets, such as images, logos, etc

    static.zip

Typescript

We will be using typescript in this project. Typescript is an extremely powerful and useful tool when dealing with data. By checking what type of data is being fetched, you can avoid unintentional bugs. Check out this section for more information.

Install Typescript

Learn how to install Typescript on your Gatsby project by following this tutorial.

// gatsby-config.js

plugins: [
    `gatsby-plugin-typescript`,
    // More plugins...
],

Allows Gatsby to build TypeScript and TSX files.

npm i gatsby-plugin-typescript

With TypeScript, JavaScript can be extended to support tools for large-scale JavaScript applications on any device or operating system. It can be compiled into readable and standards-compliant JavaScript.

npm i typescript --save-dev

Allowing types for React.

npm i --save-dev @types/react @types/react-dom @types/node

Finally, change the following files to .tsx instead of .js.

  • header.js → header.tsx
  • layout.js → layout.tsx
  • seo.js → seo.tsx
  • 404.js → 404.tsx
  • index.js → index.tsx
  • page-2.js → page-2.tsx

*Make sure to not change the Gatsby configuration at the bottom.

React plugin type

It's possible to encounter issues with react plugins that aren't compatible with Typescript. For example, the helmet plugin in SEO. To fix it, install the type version of it.

npm i --save-dev @types/react-helmet

READ NEXT

Adaptive Layout and Styled Components

Templates and source code

Download source files

Download the videos and assets to refer and learn offline without interuption.

check

Design template

check

Source code for all sections

check

Video files, ePub and subtitles

Videos

Assets

ePub

Subtitles

Meet the instructor

We all try to be consistent with our way of teaching step-by-step, providing source files and prioritizing design in our courses.

Willie Yam

Front-end/UI developer at Design+Code

I do UI coding. HTML/CSS/JS/SWIFTUI dev.

icon

10 courses - 37 hours

course logo

Design and Prototype an App with Play

Build a completely functional prototype without writing a single line of code from your phone

3 hrs

course logo

Create a 3D site with game controls in Spline

Build an interactive 3D scene implemented on a ReactJS site using Figma and Spline

2 hrs

course logo

Build a Movie Booking App in SwiftUI

Learn how to create an iOS app based on a beautiful UI design from Figma with interesting animations and interactions, create a custom tab bar and use navigation views to build a whole flow

1 hrs

course logo

Build Quick Apps with SwiftUI

Apply your Swift and SwiftUI knowledge by building real, quick and various applications from scratch

11 hrs

course logo

CSS Handbook

A comprehensive series of tutorials that encompass styled-components, CSS, and all layout and UI developments

1 hrs

course logo

Advanced React Hooks

Learn how to build a website with Typescript, Hooks, Contentful and Gatsby Cloud

5 hrs

course logo

Unity for Designers

If you want to make a game and don't know where to start, you are in the right place. I will teach you how to use Unity, code in C# and share essential tips and tricks to make your first game.

5 hrs

course logo

Create a Javascript Game

Learn how to create a web game using Phaser 3, a popular javascript game engine. Draw a map using an editor, implement the player, make the player move, apply physics, collisions, and implement the enemies.

2 hrs

course logo

Build an ARKit 2 App

Introduction to ARKit and learn how to make your own playground. You will be able to add models or even your own designs into the app and play with them

4 hrs

course logo

Create a SpriteKit Game

Overview of SpriteKit a powerful 2D sprite-based framework for games development from Apple and learn how to create your very own platform

3 hrs

Test your knowledge of Advanced React Hooks. Complete the course and get perfect results for this test to get your certificate.