{
"repdata": [
{
"id": "1",
"name": "Nikhil Garakapati",
"username": "Nikhil",
"email": "nikhil@gmail.com",
"representative region": "ANDHRA PRADESH",
"representative hq": "Chittor",
"representative area": "Chittor",
"customer name": "VasaviMeds",
"customer pincode": "4343434",
"customer phone": "11111111",
"phone": "1212121212"
},
{
"id": "2",
"name": "Nikhil Garakapati",
"username": "Nikhil",
"email": "nikhil@gmail.com",
"representative region": "ANDHRA PRADESH",
"representative hq": "Chittor",
"representative area": "Chittor",
"customer name": "MegaMeds",
"customer pincode": "4343434",
"customer phone": "22222222",
"phone": "1212121212"
}]}
This is my sample response on localhost:5000/api/ using Nodejs. I've hardcoded the json data in my nodejs file. I'm trying to extract this JSON data in my react-admin dashboard, but unable to do it. Here's my react code snippet:
import React from 'react';
import { Admin, Resource, ListGuesser, EditGuesser } from 'react-admin';
import { UserList} from './users';
import { UserCreate} from './userCreate';
import jsonServerProvider from 'ra-data-json-server';
//import { CommentList } from './comments';
const dataProvider = jsonServerProvider('localhost:5000/api');
function App() {
return(
<Admin title="dashboard" dataProvider={dataProvider}>
<Resource name="repdata" list={UserList} edit={EditGuesser} create={UserCreate}/>
</Admin>
)
}
export default App;
Can anyone help how to perfectly connect the nodeJs and React-admin?