React — Fetch

Stela Capsa
Aug 3, 2021

--

We all know that React is a frontend JavaScript library. Fetching in react is a way of manipulating data API.

pictures table
users table

If we have this two tables builded in Rails as data base to be manipulated and the data JASON looks like:

Users table
Pictures table

Picture with id: 36 belongs_to user_id: 40 that has user_name: “Juan” and also it has a description and image_url.

fetching pictures URL

The state is an empty array, with fetch we bring the data from the Rails backend to the React frontend. With the key picture can display the data and style it.

Happy Coding!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response