שגיא שלום
שגיא שלום

Reputation: 17

React-admin table displays twice

From some reason the code I write here build 2 tables and displaying both. I tried to re-write it many times and still displaying 2 tables.

enter image description here

users.js enter image description here

results:

enter image description here

what should I try?

Upvotes: 1

Views: 638

Answers (2)

François Zaninotto
François Zaninotto

Reputation: 7335

The <Admin> component should only have <Resource> components as children. Your <Users> component should be passed as the list prop of a resource:

const App = () =>
   <Admin dataProvider={myDataProvider}>
       <Resource list={Users} />
   </Admin>;

This is well documented in https://marmelab.com/react-admin/Tutorial.html#mapping-api-endpoints-with-resources

Upvotes: 1

JulienD
JulienD

Reputation: 7293

It may be that you loaded the entire App component twice. To test that you can try to render some string in the App component. It could also be that Admin renders Users already.

Upvotes: 0

Related Questions