您好,我是打字稿新手,但我对情感Js的useTheme有以下问题,我有这段代码:
const GlobalStyle: React.FC = (props) => {
const Theme = useTheme();
return (
<Global
styles={css`
@import url('https://fonts.googleapis.com/css?family=Poppins&display=swap');
@import url('https://fonts.googleapis.com/css?family=Roboto&display=swap');
body > #emasa > div {
height: 100vh;
}
* {
padding: 0;
margin: 0;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
*:focus {
outline: 0;
outline: none;
}
a {
text-decoration: none;
color: inherit;
cursor: pointer;
}
button {
background-color: transparent;
color: inherit;
border-width: 0;
padding: 0;
cursor: pointer;
}
figure {
margin: 0;
}
input::-moz-focus-inner {
border: …Run Code Online (Sandbox Code Playgroud) 我将从后端获得的内容保存到本地存储:+
async onSubmit(e){
e.preventDefault();
const {login, password } = this.state;
const response = await api.post('/login', { login,password });
const user = response.data.user;
const {jwt} = response.data;
console.log(user);
localStorage.setItem('token', jwt);
localStorage.setItem('user', user);
this.props.history.push("/home");
}
Run Code Online (Sandbox Code Playgroud)
我的
const user = response.data.user;
返回这个:
{id: 2, name: "spt", email: "email", login: "spt", password: "$2a$10$Rqc1VU1TfKD6MypNzbgemeR0O4YeXIFy1XiURjNeHk0gpWJitp4da", …}
Run Code Online (Sandbox Code Playgroud)
两个对象 [对象对象]