Skip to content

Commit 672bf85

Browse files
committed
fix: rename newSWR to useSWR
1 parent e34d844 commit 672bf85

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ npm install @cicerchie/svelte-swr
4141

4242
```svelte
4343
<script>
44-
import { newSWR } from "@cicerchie/svelte-swr";
44+
import { useSWR } from "@cicerchie/svelte-swr";
4545
46-
const players = newSWR<PlayerList>();
46+
const players = useSWR<PlayerList>();
4747
4848
$: players.update({
4949
key: `players?page=${page}&filter=${JSON.stringify(filter)}`,

src/lib/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export { getValuesFromCacheByKeysStartingWith } from "./cache";
22
export { globalIsFetching } from "./indicator";
3-
export { newSWR } from "./swr";
3+
export { useSWR } from "./swr";

src/lib/swr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const swrMachine: FSMMachineConfig = {
101101
},
102102
};
103103

104-
export function newSWR<T>() {
104+
export function useSWR<T>() {
105105
// const store = writable<SWRStore<T>>({ ...defaultSWRStore }, () => {
106106
// fsm.setEnabled(true);
107107
// return () => {

0 commit comments

Comments
 (0)