score:0
from https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation
note: you should not use fetch() to call an api route in getstaticprops. instead, directly import the logic used inside your api route. you may need to slightly refactor your code for this approach.
fetching from an external api is fine!
score:0
you should check if categories exist
export default function homemain({categories}) {
if(categories){
return <loading component />
}
rest of the code...
}
Source: stackoverflow.com
Related Query
- Next js component doesn't show without reload
- ReactJS - Importing component doesnt show up in DOM
- How to reload a component without refreshing the entire page?
- How to show Step next and previous without using Switch Case statement
- How to reload a react component without using any event handler?
- What is the best way to show loading screen on every components when component is not fully rendered WITHOUT REPEATING CODES
- React: Refresh component without reload after deleting an item
- Show next and previous buttons without pagenumbers in ReactPaginate
- reload react component without reloading the page
- How to show first page of the route without page number on Next JS
- Can you force a React component to rerender without calling setState?
- How to pass props without value to component
- How to extend styled component without passing props to underlying DOM element?
- React Dev tools show my Component as Unknown
- React doesn't reload component data on route param change or query change
- Show a component on hover in reactjs
- Can't build React/Next project - found page without a React Component as default export (context api file)
- React.js: the most efficient way to pass a parameter to an event handler without bind() in a component
- React router change url without page reload
- How to detect overflow of React component without ReactDOM?
- React: Update Child Component Without Rerendering Parent
- Difference between with and without useEffect in react functional component
- React.js without JSX - "Warning: Something is calling a React component directly. Use a factory or JSX instead"
- How to reload a component (part of page) in reactjs?
- Pass custom prop or data to Next JS Link component
- Why react dev tools Profiler dont show me component props?
- MUI next Tooltip does not show on hover
- How to set App bar component without iconElementLeft?
- Best way to show a loading spinner/gif while my React component is fetching via AJAX?
- Is it possible to call dom element methods like focus() without using a ref? (Stateless Component Functions)
More Query from same tag
- .js component in a .tsx component - no overload matches this call/property does not exist on type IntrinsicAttributes
- input field values not not what expected
- React Component Not Updating After Changing A Value
- How to open a component in full screen on click of a button in react js?
- dangerouslySetInnerHTML in <td> not working when placing content inside <td>
- How to default to current UTC date/time for Material UI date time picker
- Remove item from String Array ReactJS
- In Reactjs, how to make a prop function do separate tasks and return their values according to the required condition
- Setting the state, with values from a different component
- How to access complete object from a select field in react js
- How to get children values on antd's form submit?
- How to get ":name" from "path"?
- Gojs node connecting to right
- How to redirect a link using History to a page
- Warning: setState(…): Cannot update during an existing state transition
- Vertically aligning the button with the TextField in React Material-UI
- Custom Accordion Component not rendering body elements
- showing details of a record using ReactJS
- Redux-Form v6.5.0 SubmissionError in onSubmit Function is Not Passing Along field errors / _error, giving "Uncaught (in promise)" Error in Console
- css loader not working
- Passing an array to a React component and then accessing values within that array in the child component
- Apollo GraphQL: Change default Header INSIDE React Child Component
- Await a function in a functional component
- react-hook-form access to validation rules in nested component
- Unable to implement reverse scroll pagination using InfiniteScroll with package react-infinite-scroll-component
- Reactjs : Getting a input value from many inputs
- ReactJS: submit form onChange
- How to return existing reactElement from render
- Update items and change Pie chart dynamically. React.js + D3
- Passing props to dynamic component in NextJS