
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@personio/drafts
Advanced tools
This library no longer connects to the Drafts API service, which is decommissioned. It now provides a static implementation to facilitate decommission of the service. The static implementation allows for continued operation of the existing usage in Recruiting UI until that will be refactored and usage of this library permanently decommissioned.
yarn install
yarn test
yarn lint:fix
Run
yarn add @personio/drafts
import * as React from 'react';
import { useDrafts } from '@personio/drafts';
type Props = {
companyId: number;
employeeId: number;
}
const MyComponent = ({ companyId, employeeId }: Props) => {
const LOCAL_STORAGE_KEY = 'myAwesomeKey';
const [description, setDescription] = React.useState('');
const [{ publicKey }, { setData }] = useDrafts({ companyId, employeeId });
const onSave = () => {
// Public key should be fetched on mount
// since we need it in order to encrypt the content stored in the localStorage
if (publicKey) {
setData({ localStorageKey: LOCAL_STORAGE_KEY, value: description });
}
}
return (
<>
<textarea value={description} onChange={({ target: { value } }) = setDescription(value)} />
<button onClick={onSave}>Save</button>
</>
);
}
import * as React from 'react';
import { useDrafts } from '@personio/drafts';
type Props = {
companyId: number;
employeeId: number;
}
const MyComponent = ({ companyId, employeeId }: Props) => {
const LOCAL_STORAGE_KEY = 'myAwesomeKey';
const [description, setDescription] = React.useState('');
const [{ data }, { getData }] = useDrafts({ companyId, employeeId });
React.useEffect(() => {
getData({ localStorageKey: LOCAL_STORAGE_KEY })
}, [getData]);
React.useEffect(() => {
if (data) {
setDescription(data);
}
}, [data]);
return (
<>
<textarea value={description} onChange={({ target: { value } }) = setDescription(value)} />
</>
);
}
FAQs
## DEPRECATED -- DO NOT TAKE A DEPENDENCY ON THIS LIBRARY
We found that @personio/drafts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.