score:0
why don't you call your data straight in the front end? without 'getstaticprops' or 'getserversideprops' as you said, it's a menu, so the data doesn't matter for seo.
function menucomp() {
const [data, setdata] = react.usestate()
react.useeffect(async ()=>{
const client = new apolloclient(
{uri: 'http://portfolio.local/graphql', cache: new inmemorycache()}
);
const {data} = await client.query({
query:gqlquery
myquery{
menuitems {
edges {
node {
id
label
}
}
}
}
});
setdata(data)
},[])
return (...your component)
}
Source: stackoverflow.com
Related Query
- How can I use dynamic Menu Component in next.js
- How can I use one component (page) for multiple route in Next JS
- How can I use different dynamic slug url for same component React js?
- What does forwardRef by a component in React dev tools mean and how can I use it?
- How can I export a React Component as an NPM package to use in separate projects?
- How can I use react useContext , to show data from context, in the same component
- How can one use a polymer component inside a react component ? Is it possible?
- How can I cancel the next 'then' in a Promise when a React component is unmounted/reused?
- NextJS: How can I use a loading component instead of nprogress?
- How to use dynamic link in next js Image?
- How can I use useEffect in React to run some code only when the component first mounts, and some other code whenever an event occurs (repeatedly)?
- In typescript ,when Component property from connect , How can I use the Component?
- How can I use className on SVG imported as a component in Typescript React.FC
- how can i use global style when develop component library using styled-components
- How can I use a React component within a Node script?
- How can you render a react component using dynamic name?
- How can I use a react component in a function?
- How react functional component can use object variable which declared behind the usage? (include example)
- How can I use a loop to make this React component more DRY?
- React-Markdown Custom Component Declaration, How Can I Declare in the Renderer to Use a Custom Component?
- How can I use ComponentName.js instead of index.js when importing React component (from Atomic design structure directory)
- How can I use React Router's withRouter HOC inside my own higher order component (HOC)?
- How to use component level sass file in next js
- how can I add img as a dynamic component
- How can I use a class component at different places with unique IDs?
- How can I use Mocha to unit-test a React component that paints on a <canvas>?
- How can I use Local fonts in theme UI in next JS?
- How can I use React.useRef() of a component in another component?
- How can I trigger a child component function only for some specific parents component in next js?
- How can I conditionally use next/image component on React library?
More Query from same tag
- React input onchange simulation not updating value using Jest and enzyme
- How to await a specific value to exist in javascript?
- How to pass custom attribute to a styled component in a functional component?
- deployment of react.js application to apache server via react-scripts
- How to set object key in state using zustand
- image not displaying on 100% width in React JS
- ReactJS - Does render get called any time "setState" is called?
- Passing State between components in React
- Socket.io Server Emit only works after server restart
- ReactDOMServer not rendering components to string (third-party libraries - react-mathjax)
- How to use hooks inside setTimeout?
- Why React app doesn't keep nodejs server login session?
- How to stack multiple carousel components on a single page in React?
- How to get type of data from external source
- Render first few objects of JSON file in reactjs/redux
- How to export a const value in Next.js with React?
- What is best option to guard your routes in React?
- Uncaught TypeError: this.state.value.map is not a function when using React map
- how to get the text of anchor tag in jest
- How do you transition framer motion values?
- How to count number of elements in a JSON result with react js
- How to get scroll position of component?
- Packaging a customized Material UI ThemeProvider Component
- Cannot read property 'substr' of undefined in React JS inside map function
- Dynamically load initialValues in Redux Form
- How to change the animation speed of a Material-UI Linear Progress Bar indeterminate?
- how to get value of input tag in array with same attribute name in react js
- Prime react dataTable sorting is not working with Dates
- what happens after dispatch function and reducer function in react-redux?
- React Lifecycle Method not Triggered