本地存储挂钩 React Hook本地存储 安装 npm add local-storage-hook 签名 const [ localState , setLocalState ] = useLocalStorage ( key , defaultValue ) ; 用法 import React from 'react' import useLocalStorage from 'local-storage-hook' export default ( ) => { // const [localState, setLocalState] = useLocalStorage(key, defaultValue); const [ login , setLogin ] = useLocalStorage ( "login" , false ) ; return ( <