I no longer mantain this list. There are lots of other very comprehensive JavaScript link lists out there. Please see those, instead (Google "awesome JavaScript" for a start).
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
// Implementation in ES6 | |
function pagination(c, m) { | |
var current = c, | |
last = m, | |
delta = 2, | |
left = current - delta, | |
right = current + delta + 1, | |
range = [], | |
rangeWithDots = [], | |
l; |
most simple way, but it will re-render. It may be related to the scrolling restoration bug when the user return the page if your data is fetched on the client
import {useState, useEffect} from 'react'
export default function Index() {
const [mounted, setMounted] = useState(false);
useEffect(() => {
setMounted(true)