React Router v6 and Redux/toolkit

have just learned React router v6 and API layers but am finding it difficult to use it with Redux toolkit, like using those auto generated hooks from RTK Query which starts with use and ends with either mutation or Query e.g ‘useGetUsersQuery’.

And another thing is authentication, Redux/toolkit attaches the token to every request and handles token expiration and fallback requests, but with the new react-router v6 am failing to accomplish that in loaders before the page renders.

Please help.

How to I accomplish that with loaders and actions cause I can’t use hooks in loaders either