Debug when something changes in react. Relevant for React.memo
, useMemo
or useEffect
.
Example usage:
import { memo, useState, useCallback } from "react";
interface ExampleProps {
import NextAuth from "next-auth"; | |
import AzureADProvider from "next-auth/providers/azure-ad"; | |
// This really is the default config, the issue only occuries in combination | |
// with the Azure AD config and I can not give you my secrets. | |
// Please keep reading the issue, thank you :) | |
export default NextAuth({ | |
providers: [ | |
AzureADProvider({ |
let a = [1, 2, 3, 4]; | |
for (let item of a) { | |
console.log(item); | |
} | |
function* reverse () { | |
for (let i = a.length - 1; i >= 0; i--) { | |
yield a[i]; | |
} |
async function fetchJson(url, options, validate) { | |
const response = await fetch(url, options); | |
let json; | |
let jsonError; | |
try { | |
json = await response.json(); | |
} catch (error) { | |
jsonError = error; | |
} |
function alignedTable({ | |
alignments = [], | |
separator = ' ', | |
prefix = '', | |
suffix = '', | |
newLine = '\n', | |
rows = [], | |
} = {}) { | |
function toString() { | |
const lengths = {}; |
function getElementsAfter(el, {stopAt, skip, only} = {}) { | |
let elements = []; | |
while (el) { | |
while (el.nextElementSibling) { | |
el = el.nextElementSibling | |
elements.push(el) | |
} | |
while (el && !el.nextElementSibling) { | |
el = el.parentElement |
function rubberBandEffect( | |
val: number, | |
lowerBounds: number, | |
upperBounds: number, | |
padding: number = 25, | |
): number { | |
const lowerLimit = lowerBounds - padding; | |
const upperLimit = upperBounds + padding; | |
if (val < lowerLimit) { |
const util = require('util'); | |
const colorize = (str, colorCodes) => `\x1b[${colorCodes[0]}m${str}\x1b[${colorCodes[1]}m`; | |
const bold = str => colorize(str, util.inspect.colors.bold); | |
const italic = str => colorize(str, util.inspect.colors.italic); | |
const underline = str => colorize(str, util.inspect.colors.underline); | |
const inverse = str => colorize(str, util.inspect.colors.inverse); | |
const white = str => colorize(str, util.inspect.colors.white); | |
const grey = str => colorize(str, util.inspect.colors.grey); |