This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { | |
| isLoading: isAllTodoLoading, | |
| isError: isAllTodoError, | |
| data: allTodo, | |
| } = useQuery("todo/all", () => { | |
| return axios.post("http://localhost:4000/todo/all", todo) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { isLoading, isError, data } = useQuery( | |
| ["todo/detail", id], | |
| () => { | |
| return axios.get(`http://localhost:4000/todo/detail/:${id}`); | |
| }, | |
| { | |
| enabled: !!id, | |
| retry: 1, | |
| onSuccess: () => { | |
| // invalidate some query |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // in the component use it just like this | |
| const { isLoading, isError, data } = useGetTodoById(id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { id } = useParams(); // from react-router | |
| const { isLoading, isError, data } = useQuery( | |
| ["todo/detail", id], | |
| () => { | |
| return axios.get(`http://localhost:4000/todo/detail/:${id}`); | |
| }, | |
| { | |
| enabled: !!id, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { isLoading, isError, data } = useQuery( | |
| "todo/all", | |
| () => { | |
| return axios.get(`http://localhost:4000/todo/all`); | |
| }, | |
| { | |
| retry: 1, // or `true` or `false` or e.g. 6 | |
| } | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // in todo/all query we are fetching the list of all todos | |
| const { isLoading, isError, data } = useQuery("todo/all", () => { | |
| return axios.get(`http://localhost:4000/todo/all`) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { message } from "antd" | |
| const { isLoading, isError, mutateAsync } = useMutation( | |
| "todo/create", | |
| () => { | |
| return axios.post("http://localhost:4000/todo/create", task) | |
| }, | |
| { | |
| onSuccess: res => { | |
| dispatch(setTaskList(res.data.task_list)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| #Carrier wave c(t)=A_c*cos(2*pi*f_c*t) | |
| #Modulating wave m(t)=A_m*cos(2*pi*f_m*t) | |
| #Modulated wave s(t)=A_c[1+mu*cos(2*pi*f_m*t)]cos(2*pi*f_c*t) | |
| A_c = float(input('Enter carrier amplitude: ')) | |
| f_c = float(input('Enter carrier frquency: ')) | |
| A_m = float(input('Enter message amplitude: ')) |