Skip to content

Commit 63c12ec

Browse files
committed
chore: updated README.md
1 parent ea88e4b commit 63c12ec

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,23 @@ import {
2828
} from "@ryfylke-react/rtk-query-loader";
2929

3030
const loader = createLoader({
31-
queries: () => {
31+
useQueries: () => {
3232
const pokemon = useGetPokemon();
3333
const currentUser = useGetCurrentUser();
34-
return [pokemon, currentUser] as const;
34+
35+
return {
36+
queries: {
37+
pokemon,
38+
currentUser,
39+
},
40+
};
3541
},
3642
onLoading: () => <div>Loading pokemon...</div>,
3743
});
3844

39-
const Pokemon = withLoader((props, queries) => {
40-
const pokemon = queries[0].data;
41-
const currentUser = queries[1].data;
45+
const Pokemon = withLoader((props, loader) => {
46+
const pokemon = loader.queries.pokemon.data;
47+
const currentUser = loader.queries.currentUser.data;
4248

4349
return (
4450
<div>
@@ -89,4 +95,5 @@ What if we could instead "join" these queries into one, and then just return ear
8995
- [x] Easy to write re-usable loaders that can be abstracted away from the components
9096

9197
## [Documentation](https://rtk-query-loader.ryfylke.dev)
98+
9299
## [Quick Guide](https://rtk-query-loader.ryfylke.dev/Quick%20Guide/)

0 commit comments

Comments
 (0)