This file contains hidden or 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 function useLocalStorageSize() { | |
| const [localStorageSize, setLocalStorageSize] = useState(0); | |
| useEffect(() => { | |
| const calculateLocalStorageSize = () => { | |
| let totalSize = 0; | |
| for (let key in localStorage) { | |
| if (Object.prototype.hasOwnProperty.call(localStorage, key)) { |
This file contains hidden or 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, useCallback, useRef, useEffect } from "react"; | |
| export const useHttpClient = () => { | |
| const [isLoading, setIsLoading] = useState(false); | |
| const [error, setError] = useState(); | |
| // bu hook'un kullanıldığı component her render olduğunda aynı kalacak bir değişken oluşturur. | |
| const activeHpptRequests = useRef([]); | |
| const sendRequest = useCallback( |
This file contains hidden or 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 React, { useState, useEffect, useRef } from 'react'; | |
| import Card from '../UI/Card'; | |
| import './Search.css'; | |
| const Search = React.memo(props => { | |
| const { onLoadIngredients } = props; | |
| const [enteredFilter, setEnteredFilter] = useState(''); | |
| const inputRef = useRef(); |