Obtenez des paramètres de requête réagir
new URLSearchParams(this.props.location.search).get("your_query_param_key")
Testy Tarsier
new URLSearchParams(this.props.location.search).get("your_query_param_key")
//installation
npm i react-query
// or
yarn add react-query
https://www.youtube.com/watch?v=x1rQ61otgtU
const {
2 data,
3 dataUpdatedAt,
4 error,
5 errorUpdatedAt,
6 failureCount,
7 isError,
8 isFetched,
9 isFetchedAfterMount,
10 isFetching,
11 isIdle,
12 isLoading,
13 isLoadingError,
14 isPlaceholderData,
15 isPreviousData,
16 isRefetchError,
17 isRefetching,
18 isStale,
19 isSuccess,
20 refetch,
21 remove,
22 status,
23 } = useQuery(queryKey, queryFn?, {
24 cacheTime,
25 enabled,
26 initialData,
27 initialDataUpdatedAt
28 isDataEqual,
29 keepPreviousData,
30 meta,
31 notifyOnChangeProps,
32 notifyOnChangePropsExclusions,
33 onError,
34 onSettled,
35 onSuccess,
36 placeholderData,
37 queryKeyHashFn,
38 refetchInterval,
39 refetchIntervalInBackground,
40 refetchOnMount,
41 refetchOnReconnect,
42 refetchOnWindowFocus,
43 retry,
44 retryOnMount,
45 retryDelay,
46 select,
47 staleTime,
48 structuralSharing,
49 suspense,
50 useErrorBoundary,
51 })
52
53 // or using the object syntax
54
55 const result = useQuery({
56 queryKey,
57 queryFn,
58 enabled,
59 })