import React, { useState, useEffect } from 'react';
import { Table } from "react-bootstrap";
export default function Users() {
const [data, setData] = useState([])
useEffect(() => {
let url = "https://jsonplaceholder.typicode.com/users"
fetch(url).then((response) => {
response.json().then((result) => {
console.warn(result)
setData(result)
})
})
}, [])
return (
User Component
| Id | Name | Address | |
|---|---|---|---|
| {item.id} | {item.name} | {item.email} | {item.address.street} |
Top comments (2)
can anyone solve this issue?
Hopefully you've solved it by now, but it is difficult to address your specific issue as your code formatting is broken.
Possible issues:
returnstatementAn arrow function has an implicit return if no braces (
{ }) are used. If braces are used and you intended to return an object rather than defined a code block, then you need to wrap the object in parenthesis (({ })).If you are using an arrow function with map and returning nothing, then you should either use
.forEachinstead, or add a return value.