computer-scienceangular-roadmapbackend-roadmapblockchain-roadmapdba-roadmapdeveloper-roadmapdevops-roadmapfrontend-roadmapgo-roadmaphactoberfestjava-roadmapjavascript-roadmapnodejs-roadmappython-roadmapqa-roadmapreact-roadmaproadmapstudy-planvue-roadmapweb3-roadmap
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
426 B
16 lines
426 B
/** |
|
* Makes sure that the props are fetched only on server and not in browser |
|
* @param callback |
|
* @returns {Function} |
|
*/ |
|
export const serverOnlyProps = (callback) => { |
|
return async (props) => { |
|
// noinspection JSUnresolvedVariable |
|
if (process.browser) { |
|
// noinspection ES6ModulesDependencies,JSUnresolvedVariable |
|
return __NEXT_DATA__.props.pageProps; |
|
} |
|
|
|
return await callback(props) |
|
}; |
|
};
|
|
|