shortid
is deprecated, because the architecture is unsafe.
nanoid
is a secure alternative to shortid
. It is a tiny, secure, URL-friendly, unique string ID generator for JavaScript.
Also note that nanoid
is faster than shortid
.
import { nanoid } from 'nanoid'
model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT"