You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -128,14 +126,13 @@ Additional options are passed to [React Query](https://tanstack.com/query/v5/)'s
128
126
129
127
Check [the useMutation documentation](https://tanstack.com/query/v5/docs/react/reference/useMutation) for a detailed description of all options.
130
128
131
-
**Tip**: In react-admin components that use `useCreate`, you can override the mutation options using the `mutationOptions` prop. This is very common when using mutation hooks like `useCreate`, e.g., to display a notification or redirect to another page.
129
+
**Tip**: In ra-core components that use `useCreate`, you can override the mutation options using the `mutationOptions` prop. This is very common when using mutation hooks like `useCreate`, e.g., to display a notification or redirect to another page.
132
130
133
-
For instance, here is a button using `<Create mutationOptions>` to notify the user of success using the bottom notification banner:
131
+
For instance, here is a button using `<CreateBase mutationOptions>` to notify the user of success using the bottom notification banner:
The `onSuccess` callback is called when the mutation succeeds. It's the perfect place to display a notification or to redirect the user to another page.
In `pessimistic` mutation mode, `onSuccess` executes *after* the `dataProvider.create()` responds. React-admin passes the result of the `dataProvider.create()` call as the first argument to the `onSuccess` callback.
297
+
In `pessimistic` mutation mode, `onSuccess` executes *after* the `dataProvider.create()` responds. Ra-core passes the result of the `dataProvider.create()` call as the first argument to the `onSuccess` callback.
296
298
297
299
In `optimistic` mutation mode, `onSuccess` executes *before* the `dataProvider.create()` is called, without waiting for the response. The callback receives no argument.
React-admin stores the `dataProvider` object in a React context, so it's available from anywhere in your application code. The `useDataProvider` hook exposes the Data Provider to let you call it directly.
5
+
Ra-core stores the `dataProvider` object in a React context, so it's available from anywhere in your application code. The `useDataProvider` hook exposes the Data Provider to let you call it directly.
10
6
11
7
## Syntax
12
8
@@ -34,7 +30,7 @@ Here is how to query the Data Provider for the current user profile:
34
30
35
31
```jsx
36
32
import { useState, useEffect } from'react';
37
-
import { useDataProvider } from'react-admin';
33
+
import { useDataProvider } from'ra-core';
38
34
import { Loading, Error } from'./MyComponents';
39
35
40
36
constUserProfile= ({ userId }) => {
@@ -94,15 +90,15 @@ const dataProvider = {
94
90
It is necessary to use `useDataProvider` in conjunction with React Query's `useMutation` to call this method when the user clicks on a button:
0 commit comments