-
Scrapbox
- Memorize user icons
- Memorize the project name
-
In the future, maybe even the user’s preferred scroll position?
Config.ts
index.tsx
import Config from "./Config";
Config.load();
initializeGlobalState.ts
localDB.ts
ScrapboxDialog.tsx
export const ScrapboxDialog = () => {
...
const [g] = useGlobal();
...
const projectName = g.config.project_name;
...
const handleClose = () => {
Config.save();
setDialog(null);
};
...
const onChangeProjectName = (e: React.ChangeEvent<HTMLInputElement>) => {
updateGlobal((g) => {
g.config.project_name = e.target.value;
});
};
...
return (...
<label>Project Name: </label>
<input
type="text"
defaultValue={projectName}
onChange={onChangeProjectName}
></input>
...
);
};
I use immer to update the status. updateGlobal.ts
This page is auto-translated from /nishio/✅Keichoの設定を保存する using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I’m very happy to spread my thought to non-Japanese readers.