我有一个我从create-react-app创建的react应用。在src文件中,我还有一个名为setupProxy.js proxy的文件。里面我有以下代码:
module.exports = function(app) {
app.get('/auth/login' , (req,res,next) => {
req.redirect('/page1')
};
<form action="/auth/Login" method="post" autoComplete="off">
<div className="UsernameInput">
<TextField
id="username"
label="Username"
className={classes.textField}
variant="outlined"
required={true}
InputLabelProps={{
classes: {
root: classes.cssLabel,
focused: classes.cssFocused,
},
}}
InputProps={{
classes: {
root: classes.cssOutlinedInput,
focused: classes.cssFocused,
notchedOutline: classes.notchedOutline,
}
}}
/>
</div>
<div className="PasswordInput">
<TextField
required={true}
id="password"
className={classes.textField}
variant="outlined"
type={showPassword ? 'text' : 'password'}
label="Password"
InputLabelProps={{
classes: {
root: classes.cssLabel,
focused: classes.cssFocused,
},
}}
InputProps={{
classes: {
root: classes.cssOutlinedInput,
focused: classes.cssFocused,
notchedOutline: classes.notchedOutline,
},
endAdornment: (
<InputAdornment position="end">
<IconButton
edge="end"
aria-label="Toggle password visibility"
onClick={handleClickShowPassword}
>
{showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton>
</InputAdornment>
),
}}
/>
</div>
执行重定向时,它成功地更改了页面,但是当它执行时,它首先显示了空白的白色页面,然后加载了该页面。
为什么这样做?