Gosha Arinich is right, you should return your <li> element. But, nevertheless, you should get nasty red warning in the browser console in this case

Each child in an array or iterator should have a unique "key" prop.

so, you need to add "key" to your list:

this.state.data.map(function(item, i){
  console.log('test');
  return <li key={i}>Test</li>
})

or drop the console.log() and do a beautiful oneliner, using es6 arrow functions:

this.state.data.map((item,i) => <li key={i}>Test</li>)

IMPORTANT UPDATE:

The answer above is solving the current problem, but as Sergey mentioned in the comments: using the key depending on the map index is BAD if you want to do some filtering and sorting. In that case use the item.id if id already there, or just generate unique ids for it.

Answer from Dmitry Birin on Stack Overflow
🌐
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 React Bootcamp React Certificate ... The map() method creates a new array with the results of calling a function for every array element.
🌐
Geekster
geekster.in › home › use of map in react
Use of Map in React With Example
June 17, 2024 - map() is used in React to iterate over an array of data and dynamically render UI components based on that data.
🌐
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 - The Array.map method is a powerful higher-order function that lets you transform all the values in an array using a mapping function. This is especially useful for inserting a list of data into a React app, since you can't use for loops.
🌐
React
legacy.reactjs.org › docs › lists-and-keys.html
Lists and Keys – React
We assign the new array returned by map() to the variable doubled and log it: const numbers = [1, 2, 3, 4, 5]; const doubled = numbers.map((number) => number * 2);console.log(doubled); This code logs [2, 4, 6, 8, 10] to the console. In React, transforming arrays into lists of elements is nearly identical.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-render-lists-in-react
How to Render Lists in React using array.map()
April 10, 2023 - To get the names of the applicants, you can easily do that with JavaScript's array.map method. Below is how you can map every applicant's name: import React from 'react'; const applicants = [ { name: 'Joe', work: 'freelance-developer', blogs: '54', websites: '32', hackathons: '6', location: 'morocco', id: '0', }, { name: 'janet', work: 'fullstack-developer', blogs: '34', websites: '12', hackathons: '8', location: 'Mozambique', id: '1', }, ]; function App() { return ( <> {applicants.map(function(data) { return ( <div> Applicant name: {data.name} </div> ) })} </> ) } export default App;
🌐
React
react.dev › learn › rendering-lists
Rendering Lists – React
You will often want to display multiple similar components from a collection of data. You can use the JavaScript array methods to manipulate an array of data. On this page, you’ll use filter() and map() with React to filter and transform your array of data into an array of components.
Find elsewhere
🌐
W3Schools
w3schools.com › react › react_es6_array_methods.asp
React ES6 Array Methods
The .map() method allows you to run a function on each item in the array, returning a new array as the result. In React, map() can be used to generate lists.
🌐
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
The Array.map() method is key to rendering objects and data in react and it is a prototype function on all arrays in JavaScript.
🌐
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 ... 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(...
🌐
DEV Community
dev.to › inverseswirl › 4-easy-ways-to-loop-data-in-react-array-map-method-4f3l
4 Easy ways to loop data in React- Array.map() method! - DEV Community
December 14, 2021 - const Library = () => { return ( <div> <h1>Book Names</h1> {books.map((book)=> <p key={book.id}>{book.name} </p>) } <h2>Year published</h2> {books.map((book)=> <li key={book.id}>{book.year_published}</li> )} </div> ); }; The array to be looped can be huge. To keep the code clean, it is best to refractor the JSX elements inside the parent component into a separate child component.
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
React - Use Array.map() to Dynamically Render Elements - .map is different than in js
January 25, 2023 - Tell us what’s happening: The .map method in this challenge is some crooked JavScript… What is this ? this.state.toDoList.map(item => <li>{item}</li>) normally JavaScript wouldn’t spit anything out of that… an object…
🌐
Medium
medium.com › @react-dojos › using-javascript-maps-instead-of-arrays-in-react-advantages-and-disadvantages-c6af61d2a89d
Using JavaScript Maps Instead of Arrays in React: Advantages and Disadvantages | by React Dojo | Medium
March 2, 2023 - Im a fan of changes and like to explore the new syntax and new approaches today I want to show you how to replace the traditional way of using array and map to load a set of data in React.
🌐
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.
🌐
Linguine Code
linguinecode.com › home › blog › how to use array.map() to render data in react
How to use Array.map() to render data in React
December 18, 2020 - Array.map() is going to loop through the array of data, and give you access of each item in the array in a callback function.
🌐
GUVI
guvi.in › blog › programming languages › how to render an array of objects in react? [in 3 easy steps]
How to Render an Array of Objects in React? [in 3 easy steps]
October 21, 2025 - The most popular way to create a list or render an array of objects in React is using the array.map() method which takes an array of data and maps it to an array of components, so that each data item is represented by a corresponding component.
🌐
GitHub
github.com › Asabeneh › 30-Days-Of-React › blob › master › 06_Day_Map_List_Keys › 06_map_list_keys.md
30-Days-Of-React/06_Day_Map_List_Keys/06_map_list_keys.md at master · Asabeneh/30-Days-Of-React
An array is the most frequently used data structure to handle many kinds of problems. In React, we use map to modify an array to list of JSX by adding a certain HTML elements to each element of an array.
Author   Asabeneh
🌐
SheCodes
shecodes.io › athena › 7184-how-to-use-the-map-method-in-react
[React] - How to use the map method in React - SheCodes | SheCodes
Learn how to use the .map() method in React to iterate through an array and render a list of elements. Read this article for more information.
🌐
Softwareshorts
softwareshorts.com › render-array-objects-array-map-react
How to render an array of objects with Array.map in React | SoftwareShorts
To prevent issues React asks you to pass in a unique key for each item in the array so if the array changes React knows how to handle it. Array.prototype.map or Array.map for short is a method on Javascript arrays that allows you to map/convert the array items to something else and does not mutate.