This file contains 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 { createContext, useReducer } from "react"; | |
export const WorkoutsContext = createContext(); | |
const workoutsReducer = (state, action) => { | |
switch (action.type) { | |
case "SET_WORKOUTS": | |
return { | |
workouts: action.payload, | |
}; |
This file contains 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 html2canvas from "html2canvas"; | |
import { jsPDF } from "jspdf"; | |
const PDFDownload = () => { | |
const ref = React.createRef(); | |
const handleDownloadPdf = async () => { | |
const element = ref.current; | |
const canvas = await html2canvas(element, { |
This file contains 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
// the pageParam variable is very important, it is destructured from the object react query sends as a parameter to | |
//apiFunction, pageParam contains the current page number value which is key to the infinite query pattern | |
export const apiFunction = async ({ queryKey, pageParam }) => { | |
const [, params] = queryKey; | |
const { type, status, search, id } = params; | |
// sample params |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.