Use `const` as setter should be used to change values

This commit is contained in:
Franck Royer 2021-07-15 14:11:00 +10:00
parent a8e2b908ba
commit bc3b00b13e
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 4 additions and 4 deletions

View File

@ -74,10 +74,10 @@ async function retrieveStoreMessages(
}
export default function App() {
let [newMessages, setNewMessages] = useState<Message[]>([]);
let [archivedMessages, setArchivedMessages] = useState<Message[]>([]);
let [waku, setWaku] = useState<Waku | undefined>(undefined);
let [nick, setNick] = useState<string>(() => {
const [newMessages, setNewMessages] = useState<Message[]>([]);
const [archivedMessages, setArchivedMessages] = useState<Message[]>([]);
const [waku, setWaku] = useState<Waku | undefined>(undefined);
const [nick, setNick] = useState<string>(() => {
const persistedNick = window.localStorage.getItem('nick');
return persistedNick !== null ? persistedNick : generate();
});