Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const [isPending, setIsPending] = useState(false);
const [name, setName] = useState('');
const {
bpDisplayIcon,
label: { singular: collectionLabel },
} = schema;
return (
setIsOpen(false)}
hasBackdrop={true}
usePortal={true}
>
<div>
}
placeholder={`Name a new ${collectionLabel}...`}
large={true}
onChange={(e) => setName(e.target.value)}
onKeyDown={(e) => {
if (e.key === 'Enter' && name.length > 0) {
const res = onCreateCollection(name);
if (typeof res.then === 'function') {
setIsPending(true);
res.then(() => {
setIsOpen(false);
setIsPending(false);
});</div>