Created
November 27, 2021 10:59
-
-
Save jacobdo2/8c46c7a0f74d72c854284a9b815bc398 to your computer and use it in GitHub Desktop.
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
export default function Parent() { | |
const [items, setItems] = useState([]); | |
const firstNewItemIndex = useRef(); | |
const handleSetItems = () => { | |
setItems((prevItems) => { | |
firstNewItemIndex.current = prevItems.length + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment