React With Rails Api

Images controller index
fetching images
  • I create a function to call when I need to get the images
  • I use the fetch method to get the images information from my API
  • I then use response.json() to return the information i received as json format.
  • Then I dispatch function SetImages which i created passing in the json formatted images information.
  • The setImages function passes the Images JSON data which is then passed to the images reducers which updates it state with A array of all the images.
Image Show page using React

--

--

--

Full Stack Web Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vinesh Persaud

Vinesh Persaud

Full Stack Web Developer

More from Medium

Sporum: A Ruby on Rails, React project

Phase 3 — Ruby with a Little React

Fallback Routes for React Rails App

A React Christmas