frontend-challenges
frontend-challenges copied to clipboard
16 - re-render
components/very-slow-component.jsx
import React from "react";
const wait = (ms) => {
const start = Date.now();
let now = start;
while (now - start < ms) now = Date.now();
};
export const VerySlowComponent = React.memo(() => {
wait(500);
return null;
});
export const AnotherVerySlowComponent = React.memo(() => {
wait(500);
return null;
});