holy zheng
holy zheng

Reputation: 91

In react-admin, how can i update my current view when i using fetch to get data?

In react-admin, All I know is that the framework provides two ways for me to update, they are setting dataProvider refresh to true and refreshbutton. Now my situation is that I have a dialog which used to pay. And the pay request is not restful api. So I have to use 'fetch'. And after pay, How can I refresh the current View to get lastest data?

Upvotes: 4

Views: 1004

Answers (2)

MaxAlex
MaxAlex

Reputation: 3319

You can import and dispatch Redux action "refreshView" from 'ra-core', example: https://github.com/marmelab/react-admin/blob/master/packages/ra-ui-materialui/src/button/RefreshButton.js

Upvotes: 1

Gaurav Mithas
Gaurav Mithas

Reputation: 75

please provide more details. Also, view is auto refreshed when state/prop is updated!

In rare cases, forceupdate() can be used

Upvotes: 1

Related Questions