Redirect after login with state

Not having much luck getting returned to my cart after login. I’m using a SPA w/one page login and wanting authentication before sending the cart state to stripe, and all that works except that on return after login it goes to homepage without session state. I’m a newbie programmer without much experience. I’ve tried to config the provider without luck. I have the login button as it’s own component:

import { useState} from 'react';
const authLoginButton = () => {

  if(receivedState === retrieveStateStoredLocally()) {
       returnTo: window.location.origin
  // Authorized request --- redirect back to checkout

} else {
  // This response is not for us, reject it -- redirect back to homepage.
}

  return (
    <div>
      <button className='mt-auto button'>
        <a href="/api/auth/login/callback?...&state=abcABC123">Login from Auth0</a>
      </button>
    </div>
  )
};

export default authLoginButton

Question: is there any code examples that have a simple callback without use typescript.