Skip to content

Instantly share code, notes, and snippets.

View Konstantinacc's full-sized avatar

Konstantina Kastanara Konstantinacc

View GitHub Profile
@Konstantinacc
Konstantinacc / React example: calculate square of a number with useMemo.md
Last active March 15, 2022 08:36
React example: calculate square of a number with useMemo
import React, { useState, useMemo } from "react";

const calculateSquare = (number) => {
  console.log("calculateSquare function called!");
  if (number === 0) return 0;
  return number * number;
};

const App = () => {