Skip to content

Releases: aws-amplify/amplify-ui

@aws-amplify/[email protected]

01 Feb 04:49
7ca098e
Compare
Choose a tag to compare

Patch Changes

@aws-amplify/[email protected]

01 Feb 04:49
7ca098e
Compare
Choose a tag to compare

Patch Changes

@aws-amplify/[email protected]

01 Feb 04:49
7ca098e
Compare
Choose a tag to compare

Patch Changes

@aws-amplify/[email protected]

27 Jan 23:21
65c188f
Compare
Choose a tag to compare

Patch Changes

@aws-amplify/[email protected]

27 Jan 23:21
65c188f
Compare
Choose a tag to compare

Patch Changes

@aws-amplify/[email protected]

27 Jan 23:21
65c188f
Compare
Choose a tag to compare

Minor Changes

  • #1168 b32dd86bf Thanks @wlee221! - This enables useAuthenticator usage outside to access commonly requested authenticator context like user and route.

    First wrap your App with Authenticator.Provider:

    const App = (
      <Authenticator.Provider>
        <MyApp />
      </Authenticator.Provider>
    );

    To avoid repeated re-renders, you can pass a function that takes in Authenticator context and returns an array of desired context values. This hook will only trigger re-render if any of the array value changes.

    const Home = () => {
      const { user, signOut } = useAuthenticator((context) => [context.user]);
    
      return (
        <>
          <h2>Welcome, {user.username}!</h2>
          <button onClick={signOut}>Sign Out</button>
        </>
      );
    };
    
    const Login = () => <Authenticator />;
    
    function MyApp() {
      const { route } = useAuthenticator((context) => [context.route]);
    
      return route === 'authenticated' ? <Home /> : <Login />;
    }

Patch Changes

@aws-amplify/[email protected]

27 Jan 23:21
65c188f
Compare
Choose a tag to compare

Patch Changes

@aws-amplify/[email protected]

25 Jan 23:03
6c1c0c4
Compare
Choose a tag to compare

Patch Changes

@aws-amplify/[email protected]

25 Jan 23:03
6c1c0c4
Compare
Choose a tag to compare

Patch Changes

@aws-amplify/[email protected]

25 Jan 23:03
6c1c0c4
Compare
Choose a tag to compare

Patch Changes