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
type ValidatorFunction = (value: string) => string | null; | |
interface FormField { | |
value: string; | |
validators: ValidatorFunction[]; | |
} | |
type Form = { | |
[key: string]: FormField; | |
}; |
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 { useEffect, useRef } from 'react'; | |
function useSkipFirstRenderUseEffect(callback: () => void, dependencies: [any]) { | |
const firstRenderRef = useRef(true); | |
useEffect(() => { | |
if (firstRenderRef.current) { | |
firstRenderRef.current = false; | |
return; | |
} |
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 { useState, useEffect } from "react"; | |
export default function Pagination ({ | |
totalPages, | |
currentPage, | |
handlePageChange, | |
text, | |
className = "custom-class", | |
pageLimit = 10, // number of pages to show at a time | |
}) { |