Design+Code logo

Quick links

Suggested search

This Course

In this course, you'll learn step-by-step how to build parts of Design+Code 4 from scratch. Everything you'll code exists on the live site, using exactly the same tech stack. You'll use the bleeding edge techniques in React and CSS 3 that will prepare you for your next job, or to make your developers' lives a little easier. The UI templates, source code will be provided along with text content, videos and chat support for better understanding. You don't need programming experience since it'll be explained visually from a designer's perspective, but having minimal knowledge of HTML, CSS will help you tremendously. Finally, you can take a test after completing the course to gain a certificate.

dc-web

React Hooks

React is by far the most popular javascript framework for modern web development. Hooks make React even simpler by allowing you to create functional components using states without writing complex classes. Think of Hooks as plugins, where you can update your states with a single line of code. The main ones provided are useState and useEffect for controlling the lifecycle of your component, replacing the componentDidMount and componentDidUpdate altogether.

Note: other useful Hooks are useRef for referencing an element and useInView for detecting if an element is visible. There are also hundreds created by the community, such as in react-use. Most importantly, you can create your own reusable Hooks, like for Auth and Theme.

const [state, setState] = useState("default value")

This replaces componentDidMount:

useEffect(() => {
	// code
}, [])

This replaces componentDidUpdate for state:

useEffect(() => {
	// code
}, [state])

Styled Components

CSS by itself is the simplest way to create layouts. But with the components approach where you want things to be reusable and adaptive, it becomes hard not to rely on frameworks like Sass and javascript inline styling. That's where Styled Components come in. With it, you can write cleaner, reusable CSS, without extremely long class names or a dedicated css file for each component, and with the power of nesting in Sass and scripting with React Props.

<Wrapper>Content</Wrapper>

const Wrapper = styled.div`
	display: grid;
`

// Replaces this
<div className="long-class-name">Content</div>

// Another CSS file
.long-class-name {
	display: grid;
}

Figma Design System

This course comes with a design file made in Figma that includes the entire design system that I use for referencing the layout, colors, text styles and user interface elements. You'll be able to download this and see how our site was designed from the ground up.

figma-design

Install NodeJS

In order to install all the javascript libraries, including React, Styled Components, Gatsby and run your local web project, you'll need NodeJS. The most reliable way to install it is using their download file.

https://nodejs.org/en/

Install VSCode Code Editor

To write your code, it is essential to use a code editor. The best and most loved out there is Visual Studio Code, which has a plethora of awesome extensions like Prettier for code formatting, Styled Components for code highlighting.

https://code.visualstudio.com/download

vs-code-2

Install VSCode Extensions

  • Prettier - formats your code in a consistent way. This is important for staying in sync with teammates and while following the course. As a bonus, Prettier will make it easier to find problems in your code.
  • Styled Components - code highlights, auto-completes your css when using Styled Components.
  • GraphQL - code highlights your graphql queries.
  • Material Theme (optional) - themes for VSCode. The one I'm using is called Ocean.
  • Material Icon Theme (optional) - theme for your VSCode icons.
  • GitLens (optional) - shows the author of the code. This is great for collaboration. And blaming. ;)
  • Live Share (optional) - lets you code in real-time with other people. Great for code pairing.

vs-extension

VSCode Built-in Terminal

VSCode comes with an extremely useful terminal where you can run your commands for install libraries and start your local web enviroment in order to preview your site. The keyboard shortcut is Control `

VSCode Keyboard Shortcuts

  • Control `: toggle terminal.
  • Cmd Shift P: go to Command Palette to run commands.
  • Cmd P: open file in project.
  • Cmd B: toggle left Side Bar.

Install Gatsby

Gatsby is a framework built on top of React with essential features such as pages, templates, search engine optimization, etc. Think of it as a Wordpress for React where you can easily pick pre-made templates and plugins if you choose to. It has useful plugins for Contentful and Netlify.

https://www.gatsbyjs.com

We'll use Gatsby mainly for its performance, routing and SEO. To install, type this command in the terminal.

npm install -g gatsby-cli

To create a new project for Gatsby using the default starter template.

cd Downloads
gatsby new designcodeweb https://github.com/mengto/gatsby-starter-designcode

We're using a simplified Gatsby default starter, without complex code and all in Typescript, which will be taught later in the course. Having our own Gatsby starter also ensures that the steps will consistent in the future, avoiding confusion if for example, Gatsby decides to change their template.

Start your site!

From your Downloads folder, drag and drop to the top portion of VSCode. This will open your project files. Then, start your local environment with the following command in the terminal.

gatsby develop

Congrats, you've just started your site! If you Command click the http://localhost:8000, it'll preview your site in your favorite browser.

Gatsby Site Structure

For any site, you'll need 3 main folders:

  • components: put all the re-usable elements such as buttons, sections, layout and styles. It is best to organize into subfolders for their respective category. That's because you'll most likely end up with hundreds of components. In components/layout: you'll find the header and footer as well as the layout.css. This is where you can set your global font, links and reset your CSS if needed.
  • pages: every file here will create a new page automatically. For example, pricing.tsx will route to /pricing. The only exception is that index.tsx will route to the main page.
  • images: to simplify the implementation of local images, we made a folder at the root, in /static/images. These images will automatically be included in the public site using the url /images/your-image.svg.

Site Title

You can change the site title by going to gatsby-config.js file and edit the title property.

// gatsby-config.js

module.exports = {
  siteMetadata: {
	  title: `Design+Code`,
	  description: `Don’t skip design. Learn design and code by building real apps with React and Swift. Complete courses about the best tools.`,
	  author: `@mengto`,
	},
}

Semantic HTML and SEO

When you build a site, it is important to respect the correct structure for your texts, images and buttons. That's because search engines will read your content and index it based on your structure. Some basic rules are:

  • Every page needs an h1 for title.
  • Every page needs meta tags specifically for search engines: title, description, keywords, etc.
  • Every image needs an alt properties to explain what the image is about. This is also great for accessibility.
<img src="/images/logos/logo.svg" alt="logo" />
<h1>Design and code React apps</h1>
<p>
  Don’t skip design. Learn design and code by building real apps with
  React and Swift. Complete courses about the best tools.
</p>

Github setup

Using git is essential to work in a team environment. This will create a version control of all the changes packaged in commits and if there are conflicts, you'll be able to compare and modify appropriately.

Javascript errors

VSCode and React does a good job at telling you if there's something wrong with your code. In VSCode, you'll see a red underline if you forgot to close your brackets or tags for example. Finally, if you try to save and preview with broken code, your site will show the error and at which line number it is situated.

Homework

  • Build another site using another Gatsby starter template.
  • Import images and replace the logo with your logo.
  • Make the logo link to Home page.

READ NEXT

CSS Styling and Best Practices

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

1

Build a web app with React Hooks

Design and code a web app using React, Gatsby, Contentful, Netlify and advanced CSS techniques with Styled Components

19:23

2

CSS Styling and Best Practices

Reset your CSS, set up your fonts and create your first React component

18:14

3

Styled Components and Section Structure

Structure your Section component and install the Styled Components React library

17:06

4

Text Styles, Color Variables and Global Style

Set your text styles and light/dark mode themes based on your design system

18:50

5

Button Component and Props

Create a reusable button component and receive React props

10:13

6

CSS Grid and Position Absolute

Learn to position and align elements in a flexible layout

14:53

7

CSS Hover, Transition and 2D Transform

Create a beautiful mouse over interaction using CSS transform properties

11:15

8

CSS Selectors and Filter Effect

Powerful tricks to select elements, components and apply CSS filter effects

10:29

9

Backdrop-Filter Blur

Learn how to create a beautiful frosted glass effect in CSS

12:33

10

Perspective 3D Transforms

Use CSS transform properties to apply perspective 3D effects

10:21

11

Static Data with Arrays

Learn how to loop with the map function using arrays and objects

9:07

12

Grid Repeat and Data

Work with your static data and apply repeatable grid columns

12:05

13

Styled Component Props

Pass props to your Styled Components and use conditions to apply interesting effects

6:40

14

Toggle Menu with useState

Show and hide a floating menu using React useState

11:12

15

Visibility and Loop Condition

Apply a CSS transition on your toggle interaction and show React components based on a condition

10:56

16

Function Event and PreventDefault

Handle the click event and prevent links from their default behavior

6:36

17

Wave Component and Inline Styling

Create a wave background and use inline styling for quick CSS properties

12:05

18

CSS Keyframes Animation with Delay

Create a beautiful start animation in CSS using delays

11:22

19

Text Gradient and Media Queries

Apply a gradient to your texts and use media queries to make your layout adaptive

17:27

20

useEffect and Deploy to Netlify

Control the lifecycle of your app and publish your site online

15:51

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.

Meng To

I design, code and write

Meng To is the author of Design+Code. Meng started off his career as a self-taught designer from Montreal and eventually traveled around the world for 2 years as his US VISA was denied. During his travels, he wrote a book which now has 35,000 readers.

icon

39 courses - 184 hours

course logo

Build SwiftUI apps for iOS 18 with Cursor and Xcode

In this course, we'll explore the exciting new features of SwiftUI 6 and Xcode 16 for building iOS 18 apps. From mesh gradients and text animations to ripple effects, you'll learn how to create polished, highly custom apps using the latest workflows. We'll also dive into using Cursor and Claude AI for AI-driven coding, helping you start strong and customize your apps.

5 hrs

course logo

Create your Dream Apps with Cursor and Claude AI

Learn to build your dream web apps from the ground up using Cursor, Claude AI, and a suite of powerful AI tools. This course covers everything you need, including React for frontend development, Firebase for backend integration, and Stripe for handling payments. You’ll also dive into advanced AI tools like Claude Artifacts, Galileo AI, v0.dev for UI, Ideogram for design generation, and Cursor Composer for full-scale development.

6 hrs

course logo

Build a React Site from Figma to Codux

In this course, you'll learn to build a website from scratch using Codux, starting with a Figma template. You’ll master responsive design, collaborate with developers on a real React project, export CSS from Figma using Locofy, set up breakpoints with media queries, add CSS animations, improve SEO, create multiple pages with React Router, and publish your site. By following best practices, you’ll bridge design and development, improve your web design skills.

2 hrs

course logo

Create 3D UI for iOS and visionOS in Spline

Comprehensive 3D Design Course: From Basics to Advanced Techniques for iOS and visionOS using SwiftUI

3 hrs

course logo

Master No-Code Web Design with Framer

In this free Framer course, you'll learn to create modern, user-friendly interfaces. Start with dark mode and glass designs, then move from Figma to Framer, using vectors and auto layout for responsive websites. Add animations, interactive buttons, and custom components with code. Finally, you'll craft a design system suitable for teamwork or solo projects, all in a straightforward and practical approach.

4 hrs

course logo

Build SwiftUI Apps for iOS 17

In this course, we’ll be exploring the fresh and exciting features of SwiftUI 5! As we craft a variety of iOS apps from the ground up, we'll delve deep into the treasure trove that is SwiftUI's user interface, interactions, and animations.

4 hrs

course logo

Build Beautiful Apps with GPT-4 and Midjourney

Design and develop apps using GPT-4 and Midjourney with prompts for SwiftUI, React, CSS, app concepts, icons, and copywriting

4 hrs

course logo

Build SwiftUI apps for iOS 16

Create animated and interactive apps using new iOS 16 techniques using SwiftUI 4 and Xcode 14

5 hrs

course logo

Build a 3D Site Without Code with Framer

Design and publish a responsive site with 3D animation without writing a single line of code

3 hrs

course logo

Create 3D Site with Spline and React

Design and code a landing page with an interactive 3D asset using Spline and CodeSandbox

1 hrs

course logo

Build an Animated App with Rive and SwiftUI

Design and code an iOS app with Rive animated assets, icon animations, custom layouts and interactions

3 hrs

course logo

Build a SwiftUI app for iOS 15 Part 3

Design and code a SwiftUI 3 app with custom layouts, animations and gestures using Xcode 13, SF Symbols 3, Canvas, Concurrency, Searchable and a whole lot more

4 hrs

course logo

Build a SwiftUI app for iOS 15 Part 2

Design and code a SwiftUI 3 app with custom layouts, animations and gestures using Xcode 13, SF Symbols 3, Canvas, Concurrency, Searchable and a whole lot more

3 hrs

course logo

Build a SwiftUI app for iOS 15

Design and code a SwiftUI 3 app with custom layouts, animations and gestures using Xcode 13, SF Symbols 3, Canvas, Concurrency, Searchable and a whole lot more

4 hrs

course logo

React Livestreams

Learn how we can use React Hooks to build web apps using libraries, tools, apis and frameworks

4 hrs

course logo

Design Founder Livestreams

A journey on how we built DesignCode covering product design, management, analytics, revenue and a good dose of learning from our successes and failures

2 hrs

course logo

SwiftUI Advanced Handbook

An extensive series of tutorials covering advanced topics related to SwiftUI, with a main focus on backend and logic to take your SwiftUI skills to the next level

4 hrs

course logo

iOS Design Handbook

A complete guide to designing for iOS 14 with videos, examples and design files

2 hrs

course logo

SwiftUI Handbook

A comprehensive series of tutorials covering Xcode, SwiftUI and all the layout and development techniques

7 hrs

course logo

Build a web app with React Hooks

Learn how we built the new Design+Code site with React Hooks using Gatsby, Netlify, and advanced CSS techniques with Styled Components.

4 hrs

course logo

UI Design Handbook

A comprehensive guide to the best tips and tricks for UI design. Free tutorials for learning user interface design.

2 hrs

course logo

Figma Handbook

A comprehensive guide to the best tips and tricks in Figma

6 hrs

course logo

SwiftUI for iOS 14

Build a multi-platform app from scratch using the new techniques in iOS 14. We'll use the Sidebar and Lazy Grids to make the layout adaptive for iOS, iPadOS, macOS Big Sur and we'll learn the new Matched Geometry Effect to create beautiful transitions between screens without the complexity. This course is beginner-friendly and is taught step-by-step in a video format.

3 hrs

course logo

SwiftUI Livestreams

This is a compilation of the SwiftUI live streams hosted by Meng. Over there he talks and teaches how to use design systems, typography, navigation, iOS 14 Design, prototyping, animation and Developer Handoff.

19 hrs

course logo

UI Design Livestreams

This is a compilation of the UI live streams hosted by Meng. Over there he talks and teaches how to use design systems, typography, navigation, iOS 14 Design, prototyping, animation and Developer Handoff.

26 hrs

course logo

UI Design for Developers

In this course we'll learn how to use design systems, set up break points, typography, spacing, navigation, size rules for adapting to the iPad, mobile and web versions, and different techniques that translate well from design to code.

3 hrs

course logo

Build an app with SwiftUI Part 3

This course was written for designers and developers who are passionate about design and about building real apps for iOS, iPadOS, macOS, tvOS and watchOS. SwiftUI works across all of those platforms. While the code is not a one-size-fits-all, the controls and techniques involved can apply to all platforms. It is beginner-friendly, but it is also packed with design tricks and cool workflows about building the best UIs and interactions.

4 hrs

course logo

Build an app with SwiftUI Part 2

This course was written for designers and developers who are passionate about design and about building real apps for iOS, iPadOS, macOS, tvOS and watchOS. SwiftUI works across all of those platforms. While the code is not a one-size-fits-all, the controls and techniques involved can apply to all platforms. It is beginner-friendly, but it is also packed with design tricks and cool workflows about building the best UIs and interactions.

4 hrs

course logo

Build a full site in Webflow

Webflow is a design tool that can build production-ready experiences without code. You can implement CSS-driven adaptive layouts, build complex interactions and deploy all in one tool. Webflow also comes with a built-in content management system (CMS) and Ecommerce for creating a purchase experience without the need of third-party tools.

3 hrs

course logo

Advanced Prototyping in ProtoPie

ProtoPie is a cross-platform prototyping tool that creates prototypes nearly as powerful as those made with code, with half of the efforts, and zero code. It's perfect for designers who want to quickly experiment with advanced interactions using variables, conditions, sensors and more.

3 hrs

course logo

Build an app with SwiftUI Part 1

This course was written for designers and developers who are passionate about design and about building real apps for iOS, iPadOS, macOS, tvOS and watchOS. SwiftUI works across all of those platforms. While the code is not a one-size-fits-all, the controls and techniques involved can apply to all platforms. It is beginner-friendly, but it is also packed with design tricks and cool workflows about building the best UIs and interactions.

4 hrs

course logo

React Native for Designers Part 2

React Native is a popular Javascript framework that builds on top of React by using native components to create a real mobile app indistinguishable from one made using Xcode or Android Studio. The main difference with native development is that you get to use CSS, hot-reload, Javascript and other familiar techniques that the Web has grown over the past decades. Most importantly, you're building for both iOS and Android using the same codebase.

3 hrs

course logo

React Native for Designers

React Native is a popular Javascript framework that builds on top of React by using native components to create a real mobile app indistinguishable from one made using Xcode or Android Studio. The main difference with native development is that you get to use CSS, hot-reload, Javascript and other familiar techniques that the Web has grown over the past decades. Most importantly, you're building for both iOS and Android using the same codebase.

5 hrs

course logo

Design System in Figma

Learn how to use and design a collaborative and powerful design system in Figma. Design Systems provide a shared library of reusable components and guidelines and that will let you build products much faster

3 hrs

course logo

React for Designers

Learn how to build a modern site using React and the most efficient libraries to get your site/product online. Get familiar with Grid CSS, animations, interactions, dynamic data with Contentful and deploying your site with Netlify.

3 hrs

course logo

Swift Advanced

Learn Swift a robust and intuitive programming language created by Apple for building apps for iOS, Mac, Apple TV and Apple Watch

9 hrs

course logo

Learn Swift

Learn Swift a robust and intuitive programming language created by Apple for building apps for iOS, Mac, Apple TV and Apple Watch

4 hrs

course logo

Learn Sketch

Learn Sketch a design tool entirely vector-based and focused on user interface design

5 hrs

course logo

Learn iOS 11 Design

Learn colors, typography and layout for iOS 8

1 hrs

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