Skip to content

Instantly share code, notes, and snippets.

View yoavniran's full-sized avatar
📖
Writing. Code & Prose

Yoav Niran yoavniran

📖
Writing. Code & Prose
View GitHub Profile
@yoavniran
yoavniran / usePasteUpload.jsx
Created March 21, 2021 12:49
react-uploady usePasteUpload custom hook example
import React from "react";
import Uploady from "@rpldy/uploady";
import { usePasteUpload } from "@rpldy/upload-paste";
const ElementPaste = (props) => {
const containerRef = useRef(null);
const onPasteUpload = useCallback(({ count }) => {
console.log("ELEMENT PASTE-TO-UPLOAD files: ", count);
}, []);
@yoavniran
yoavniran / useIsMounted.js
Created June 16, 2021 07:53
useIsMounted React hook
import { useEffect, useRef, useCallback } from "react";
const useIsMounted = () => {
const mountedRef = useRef(true);
useEffect(() => {
return () => {
mountedRef.current = false;
};
}, []);
@yoavniran
yoavniran / chesstudy-id
Last active August 4, 2026 09:49
chesstudy-id
chesstudy-id v1
AsXATMby8FJKrIUrVMr01H9-mV0wB4uu4F89-zf6S2w