我正在尝试将 getServerSideProps 方法从该页面导入到另一个页面,并在多个页面中使用它。我怎样才能做到这一点?
这是我的代码:
import DashboardLayout from "@app/layout/DashboardLayout";
import Overview from "@containers/dashboard/Overview";
import { parsedCookie } from "@infrastructure/utils/functions";
const OverviewPage = () => {
return (
<DashboardLayout>
<Overview />
</DashboardLayout>
);
};
export default OverviewPage;
export const getServerSideProps = async (context) => {
const token = parsedCookie(context.req);
const { accessToken, refreshToken } = token;
if (!accessToken || !refreshToken) {
return {
redirect: {
destination: "/",
permanent: false,
},
};
}
return {
props: {},
};
};
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建一个过滤器,根据经验过滤所有候选人。我已经使用单选按钮构建了过滤器,该按钮发送工作正常,但问题是它没有被检查。默认情况下,我希望当用户单击一个 btn 时不检查每个单选按钮,然后应该检查它。当我单击 btn 时,它会过滤候选者,但单选按钮本身不会被检查。我的组件很大,这就是为什么我只提供你们都需要的代码。请帮助我正确设置单选按钮的检查。谢谢
//i'm importing this array and using it in my component
export const filtersByExp = [
{
value: 0,
label: "Fresher",
},
{
value: 1,
label: "1 year above ",
},
{
value: 2,
label: "2 year above ",
},
{
value: 3,
label: "3 year above ",
},
{
value: 4,
label: "4 year above ",
},
{
value: 5,
label: "5 year above ",
},
];
//component
const [filter, setFilter] = useState({
stage: "all", …Run Code Online (Sandbox Code Playgroud)