What is the suggested way of generating keys?
Unanswered
Satin Angora posted this in #help-forum
Original message was deleted.
1 Reply
Original message was deleted
since your data isn't coming from a db, i'm assuming you're using some kind of state
you can use a uuid.
sth like
you can use a uuid.
sth like
import {v4 as uuidv4} from 'uuid';
const addNewItem = () => {
setItems([
...items,
{
id: uuidv4().slice(0, 8),
},
]);
};