Skip to content

Instantly share code, notes, and snippets.

@superhighfives
Last active March 6, 2017 14:46
Show Gist options
  • Save superhighfives/6d3039b5d0dc9a2508ddf66275c44332 to your computer and use it in GitHub Desktop.
Save superhighfives/6d3039b5d0dc9a2508ddf66275c44332 to your computer and use it in GitHub Desktop.
Rails 5 API + ActiveAdmin + create-react-app on Heroku
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
componentDidMount() {
window.fetch('api/drinks')
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.log(error))
}
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment