#I can t yet figure out how to deal with
1 messages · Page 1 of 1 (latest)
can you give an example of how they would be different? if they are considerably different, why not have separate pages?
For example if on the desktop we have a layout with a category panel (data get from sever) - and a product list as main content, while on mobile only the product list is needed (categories are in a different page). For mobile we don't wanna fetch all the categories because we don't render it
are you fetching using multiple fetch() queries (one for categories and one for product list)? or are you using one query to fetch all that? If it's just one query, then the best thing to do would just simple be hiding categories behind a menu or not showing at all on mobile.
Two different queries, for mobile the idea is not to call the get categories api (on server side)
oh are these queries happening in a server side props function?
Yes, for example using the new experimental "use"
ok I'm not familiar with the use feature yet but I think it might not be worth optimizing for this unless it becomes a real problem for the mobile users or if you're struggling to load both on mobile (due to speed/bandwidth issues)
The same happens with getServerSideProps, if this call for categories is heavy then mobile users are unnecessarily affected. But maybe the solution is more about improving this api performance