useEffect without any params is equal to componentDidMount and for this reason, is called after the render.

So, the first time your jsx code is called, data.result.map is undefined and only after the re-render, do to the response of fetchShops(), it has a value.

You simply need to check the value like this:

data.result && data.result.map()

Answer from Marco Caldera on Stack Overflow
🌐
REACT NATIVE FOR YOU
reactnativeforyou.com › how-to-use-map-function-in-react-native
How to use Map Function in React Native – REACT NATIVE FOR YOU
January 8, 2023 - Following is how you use the map function in class-based components. import React, {Component} from 'react'; import {Text, View} from 'react-native'; export default class Home extends Component { constructor(props) { super(props); this.state = { array: [ { key: '1', title: 'example title 1', subtitle: 'example subtitle 1', }, { key: '2', title: 'example title 2', subtitle: 'example subtitle 2', }, { key: '3', title: 'example title 3', subtitle: 'example subtitle 3', }, ], }; } list = () => { return this.state.array.map((element) => { return ( <View key={element.key} style={{margin: 10}}> <Text>{element.title}</Text> <Text>{element.subtitle}</Text> </View> ); }); }; render() { return <View>{this.list()}</View>; } }
Discussions

reactjs - How to map an array of objects in React Native - Stack Overflow
Keep in mind map function only works with array and not with objects. More on stackoverflow.com
🌐 stackoverflow.com
json - React Native - map array of objects - Stack Overflow
in this JSFiddle I mapped through your response and extracted the name from the object_list object and then I flattened the outputted array because it was a 2D array. More on stackoverflow.com
🌐 stackoverflow.com
July 16, 2020
mapping - How to map an array of object in react native - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Ask questions, find answers and collaborate at work with Stack Overflow for Teams More on stackoverflow.com
🌐 stackoverflow.com
April 10, 2021
How to render an array of objects with Array.map in React
Array.map does not exist. The builtin Array does not have such a method. The only static methods which are defined are Array.from Array.isArrax and Array.of. What you are refering is on the instance of Arrays, and are accessable through the prototype-chain. The correct term would have been Array.prototype.map You've even linked to the mdn page were it is correctly defined, don't just remove things you don't understand - when you are trying to teach others. Don't forget to make proper research. More on reddit.com
🌐 r/reactjs
9
1
July 14, 2021
🌐
Stack Overflow
stackoverflow.com › questions › 71576181 › how-to-map-an-array-of-objects-in-react-native
reactjs - How to map an array of objects in React Native - Stack Overflow
How to map an array of objects in React Native Api response data Object { "data": Object { "1": Object { "fk_i_attribute_id": "1", "
🌐
Stack Overflow
stackoverflow.com › questions › 62942830 › react-native-map-array-of-objects
json - React Native - map array of objects - Stack Overflow
July 16, 2020 - in this JSFiddle I mapped through your response and extracted the name from the object_list object and then I flattened the outputted array because it was a 2D array.
Find elsewhere
🌐
Scrimba
scrimba.com › articles › react-list-array-with-map-function
How to use Array.map to render a list of items in React
November 1, 2022 - This example shows how you can take a load of data stored in an array of objects and use map to create an array of HTML. This is the foundation of using Array.map to create JSX code that can be used in React components.
🌐
React
legacy.reactjs.org › docs › lists-and-keys.html
Lists and Keys – React
We can use the same keys when we produce two different arrays: function Blog(props) { const sidebar = ( <ul> {props.posts.map((post) => <li key={post.id}> {post.title} </li> )} </ul> ); const content = props.posts.map((post) => <div key={post.id}> <h3>{post.title}</h3> <p>{post.content}</p> </div> ); return ( <div> {sidebar} <hr /> {content} </div> ); } const posts = [ {id: 1, title: 'Hello World', content: 'Welcome to learning React!'}, {id: 2, title: 'Installation', content: 'You can install React from npm.'} ]; const root = ReactDOM.createRoot(document.getElementById('root')); root.render(<Blog posts={posts} />);
🌐
MakeUseOf
makeuseof.com › home › programming › how to map over a nested array in a react component
How to Map Over a Nested Array in a React Component
September 23, 2022 - The map function loops over the items of a given array and returns the specified statement or code for each. For a flat array, the map function works as follows: const arr = ['a', 'b', 'c']; const result1 = arr.map(element => { return element; ...
🌐
GitHub
github.com › facebook › react-native › issues › 29449
How to map within this array of json objects and I want to display the image,title,quantity on the screen · Issue #29449 · facebook/react-native
July 21, 2020 - render(){ React.Children.toArray( this.state.categories.map((item,i)=> {item} ... Component: ImageNeeds: Author FeedbackNeeds: Environment InfoPlease run `react-native info` and edit your issue with that command's output.Please run `react-native ...
Author: facebook
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
Use Array.map() to Dynamically Render Elements
June 22, 2018 - Tell us what’s happening: This code works as it should but I am still failing the test. I don’t understand why. Your code so far const textAreaStyles = { width: 235, margin: 5 }; class MyToDoList extends React.Component { constructor(props) { super(props); // change code below this line this.state = { userInput: '', toDoList: [] }; // change code above this line this.handleSubmit = this.handleSubmit.bind(this); this.handleChange = this.handleChange.bind(this); ...
🌐
W3Schools
w3schools.com › react › react_es6_array_map.asp
React ES6 Array map()
React Compiler React Quiz React Exercises React Syllabus React Study Plan React Server React Interview Prep ... The map() method creates a new array with the results of calling a function for every array element.
🌐
Atomizedobjects
atomizedobjects.com › blog › react › how-to-render-an-array-of-objects-with-map-in-react
How to render an array of objects with Array.map in React | Atomized Objects
We will be using the Array.prototype.map() function in this guide (We will call it Array.map() for short in this post) to be able to render our array of objects into our JSX. If you want to learn more about what the prototype property is and what it does, I recommend the following post: Inheritance ...
🌐
Tim Mousk
timmousk.com › blog › react-map-array-of-objects
How To Map An Array Of Objects In React? – Tim Mouskhelichvili
March 16, 2023 - One of the most typical tasks when working on a React application is rendering a list of objects as components. The easiest way to map an array of objects in React is to use the JavaScript map function.
🌐
Medium
medium.com › @ahmadmalindo05 › how-to-map-nested-array-in-react-native-916b6368c54f
How to Map Nested Array in React Native - Ahmad Malindo - Medium
August 24, 2022 - How to Map Nested Array in React Native Hello Everyone in this time i share how i solve Mapping Nested Array in React Native. Example if i have this data in this data i have stuck problem how i map …
🌐
Hackingwithreact
hackingwithreact.com › read › 1 › 13 › rendering-an-array-of-data-with-map-and-jsx
Rendering an Array of Data with map() and JSX – a free Hacking with React tutorial
There's one more thing we're going to cover before you know enough React basics to be able to move on to a real project, and that's how to loop over an array to render its contents. Right now we have a single person with a single country, but wouldn't it be neat if we could have 10 people with 10 countries, and have them all rendered? Sure it would. Luckily for us, this is easy to do in JSX thanks to an array method called map().