@umang-thakkar/base-template 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umang-thakkar/base-template",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "The template for react native to setup redux and other neccesary boilerplate codes",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -24,4 +24,4 @@
24
24
  "type": "git",
25
25
  "url": "git+https://github.com/Umang2809/react-native-template.git"
26
26
  }
27
- }
27
+ }
@@ -1,4 +1,4 @@
1
1
  module.exports = {
2
2
  presets: ['module:@react-native/babel-preset'],
3
- plugins: ['react-native-reanimated/plugin'],
3
+ plugins: ['react-native-worklets/plugin',],
4
4
  };
@@ -24,6 +24,7 @@
24
24
  "react-native-reanimated": "^4.0.2",
25
25
  "react-native-safe-area-context": "^5.5.2",
26
26
  "react-native-screens": "^4.15.0",
27
+ "react-native-worklets": "^0.4.1",
27
28
  "react-native-svg": "^15.12.1",
28
29
  "react-redux": "^9.2.0"
29
30
  },
@@ -51,4 +52,4 @@
51
52
  "engines": {
52
53
  "node": ">=18"
53
54
  }
54
- }
55
+ }
@@ -2,21 +2,35 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
2
2
  import { addTodo, deleteTodo, fetchTodoById, fetchTodos } from "./service";
3
3
  const queryClient = useQueryClient()
4
4
 
5
- export const useTodos = useQuery({ queryKey: ['todos'], queryFn: fetchTodos });
5
+ export const useTodos = () => {
6
+ return useQuery({
7
+ queryKey: ['todos'],
8
+ queryFn: fetchTodos
9
+ });
10
+ };
6
11
 
7
- export const useTodoById = (id: number) => useQuery({ queryKey: ['todo', id], queryFn: () => fetchTodoById(id) })
12
+ export const useTodoById = (id: number) => {
13
+ return useQuery({
14
+ queryKey: ['todo', id],
15
+ queryFn: () => fetchTodoById(id)
16
+ });
17
+ };
8
18
 
9
- export const useAddTodo = useMutation({
10
- mutationFn: addTodo,
11
- onSuccess: () => {
12
- queryClient.invalidateQueries({ queryKey: ['todos'] });
13
- }
14
- })
19
+ export const useAddTodo = () => {
20
+ return useMutation({
21
+ mutationFn: addTodo,
22
+ onSuccess: () => {
23
+ queryClient.invalidateQueries({ queryKey: ['todos'] });
24
+ }
25
+ });
26
+ };
15
27
 
16
- export const deleteTodoMutation = useMutation({
17
- mutationFn: deleteTodo,
18
- onSuccess: () => {
19
- queryClient.invalidateQueries({ queryKey: ['todos'] });
20
- }
21
- });
28
+ export const useDeleteTodo = () => {
29
+ return useMutation({
30
+ mutationFn: deleteTodo,
31
+ onSuccess: () => {
32
+ queryClient.invalidateQueries({ queryKey: ['todos'] });
33
+ }
34
+ });
35
+ };
22
36