Skip to content

Instantly share code, notes, and snippets.

@hrishimittal
Created August 9, 2017 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrishimittal/4324936db6e3d0ce0545ec97abbdcbfc to your computer and use it in GitHub Desktop.
Save hrishimittal/4324936db6e3d0ce0545ec97abbdcbfc to your computer and use it in GitHub Desktop.

[title] How to use React with a Rails 5 API app - A hands-on tutorial

[intro]

  • React and Rails make a great combination
  • In this hands-on tutorial, I'll show you how to build a complete React app that works with a Rails 5 API
  • You need to be comfortable with Rails but don't need to be a JavaScript or React expert
  • What we're going to build - an Idea board!
  • Outline of the steps we'll take to build this app

Basics of React

Components

JSX

State

Our Rails API

Setup

Data model

### API endpoints

Building our React app

### Quick start with Create React App

Our first component

Fetching API data with axios

componentDidMount

Adding a new record - A Form component

Editing a record

### Deleting a record

Spicing up the UI with some transitions

Deploying our app to a production server

### Let's go with Heroku

Deploying the Rails app

Deploying the React app

Wrap-up

  • We learnt how to build a complete app with a Rails 5 API and React
  • It's not hard! It's just about knowing the steps.
  • We deployed it!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment