You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now I use a hook within each of these. For example:
// Custom hook to create a href without loosing any query params of the page// Takes queryparam and it's value as an argumentfunctionuseQueryParam(name,value){constpathname=usePathname();constsearchParams=useSearchParams();constparams=newURLSearchParams(searchParams);params.set(name,value);consthref=pathname+'?'+params.toString();return[href];}constPageLink=({ onClick, isActive, value })=>{const[href]=useQueryParam('page',value);// <------------- using a hook here to get the hrefreturn(<liclassName="page-item"><aclassName={clsx('page-link',isActive&&'disabled')}href={href}onClick={withPreventDefault(onClick)}>{value}</a></li>);};constEllipsis=({ onClick, isActive, value })=>{const[href]=useQueryParam('page',value);// <------------- using a hook here to get the hrefreturn(<liclassName="page-item"><aclassName={clsx('page-link',isActive&&'disabled')}href={href}onClick={withPreventDefault(onClick)}>
...
</a></li>);};
It would be cool if a href can be generated and passed through. Would it be possible? Has anyone been using this library with a href?
The text was updated successfully, but these errors were encountered:
I'd like to be able to pass props to child components viz
Right now I use a hook within each of these. For example:
It would be cool if a href can be generated and passed through. Would it be possible? Has anyone been using this library with a href?
The text was updated successfully, but these errors were encountered: