You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+63Lines changed: 63 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -250,3 +250,66 @@ Start your Rails server ```rails s``` and navigate to ```localhost:3000/api/v1/m
250
250
<ahref="http://tinypic.com?ref=2m60ahx"target="_blank"><imgsrc="http://i63.tinypic.com/2m60ahx.png"width="450"height="450"border="0"alt="Image and video hosting by TinyPic"></a>
251
251
252
252
Congrats! You have successfully created a Rails API and completed your first GET request!
253
+
254
+
## Downloading React into our Project
255
+
256
+
React is a component based front end framework that makes it easy to make frontend calls to our Rails API. Let's make this organized as possible and add our react directory inside our rails app.
257
+
258
+
1. Open your terminal and create a new project inside your API.
259
+
```
260
+
create-react-app client
261
+
```
262
+
<br>
263
+
<ahref="http://tinypic.com?ref=1zya22t"target="_blank"><imgsrc="http://i64.tinypic.com/358xiu0.png"border="0"height="300"width="280"alt="Image and video hosting by TinyPic"></a>
264
+
<br>
265
+
266
+
2. Download Boostrap into the react directory:
267
+
268
+
```
269
+
npm install --save reactstrap bootstrap@4
270
+
```
271
+
272
+
Then open your ```index.js``` file inside the ```/src``` directory and add the following import line:
273
+
```javascript
274
+
importReactfrom'react';
275
+
importReactDOMfrom'react-dom';
276
+
import'./index.css';
277
+
importAppfrom'./App';
278
+
import*asserviceWorkerfrom'./serviceWorker';
279
+
// Import goes below for Bootstrap
280
+
import'bootstrap/dist/css/bootstrap.css';
281
+
```
282
+
283
+
3. We'll make a default Component directory inside the ```/src``` folder and create our first component.
284
+
285
+
```
286
+
cd client/src && mkdir components && cd components && touch Button.js
287
+
```
288
+
4. Open your ```Button.js``` file and lets create a sample button to active our call function to the API.
0 commit comments