BTC — ETH — ICP — SOL — LIVE · updates every 60s
LedgerLifeICP · BITCOIN · DEFI · WEB3
← LedgerLife ICP

React Hook Enhances Internet Identity UX on ICP

By Maria Irene · 2 Oct 2025

The ic-use-internet-identity React hook has been updated to include reactive updates when a user’s current Internet Identity expires, improving the experience for developers and end users on the Internet Computer. While the change may appear modest, it addresses a practical issue that often disrupts user interactions.

Internet Identity is an authentication service on the Internet Computer that allows users to create a secure identity for interacting with canisters, the platform’s smart contracts. The React hook simplifies integration into applications, providing an intuitive interface for logging in and out while maintaining compatibility with other tools like ic-use-actor, which facilitates access to canister methods.

Key features of the hook include cached identity, which stores credentials in local storage to keep users logged in even after page reloads, and login progress indicators, allowing applications to track whether a user is logged in, logging in, or logged out. The recent update introduces reactive identity expiry, meaning that when an identity becomes invalid, the authentication state resets automatically and the user interface updates in real time. This avoids the need for manual refreshes or additional checks and ensures applications remain in sync with the user’s session status.

The hook also supports router integration, exposing functions like ensureInitialized() and isAuthenticated() for use outside of React components, as demonstrated in examples using TanStack Router. Developers can see the functionality in action through a demo where identities expire after ten seconds, offering a hands-on view of the new reactive behaviour.

Although the update is relatively small, it contributes to smoother user experiences on the Internet Computer and demonstrates ongoing efforts to refine developer tools. By ensuring that applications respond accurately to identity changes, ic-use-internet-identity helps maintain security, reduce friction, and provide a more reliable interface for interacting with the growing ecosystem of ICP canisters.

Demo link: https://5pfgi-wiaaa-aaaan-qz7bq-cai.icp0.io