ComponentApplicationState in .net 6 Blazor

mohammad mir 21 Reputation points
2021-10-03T11:06:28.56+00:00

hi

i have question about ComponentApplicationState in .net 6 Blazor
I Am Confused about That
whats is diffrence between ComponentApplicationState And Fluxor And Session Storage Or Local Storge

When and where to use them

thanks

Developer technologies | .NET | Blazor
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Anonymous
    2021-10-05T07:38:23.757+00:00

    Hi @mohammad mir ,

    The ComponentApplicationState service allows a component to retrieve the state when initializing the component. It applies to the Blazor component, and it is the component level sate management. You can check the following article to use it:

    Preserve Component State Tag Helper

    Prerender and integrate ASP.NET Core Razor components

    The Fluxor is a zero boilerplate Flux/Redux library, it will use a global store to store the state. Then you can get the latest state from the store. It is the application-level state management. More detail information about using it, see Fluxor - documentation.

    For transient data that the user is actively creating, a commonly used storage location is the browser's localStorage and sessionStorage collections:

    • localStorage is scoped to the browser's window. If the user reloads the page or closes and re-opens the browser, the state persists. If the user opens multiple browser tabs, the state is shared across the tabs. Data persists in localStorage until explicitly cleared.
    • sessionStorage is scoped to the browser tab. If the user reloads the tab, the state persists. If the user closes the tab or the browser, the state is lost. If the user opens multiple browser tabs, each tab has its own independent version of the data.

    More detail information, check the following links:

    Browser storage for Blazor WebAssembly app

    Browser storage for Blazor Server app


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion

    1 person found this answer helpful.
    0 comments No comments

  2. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2021-10-03T15:07:06.767+00:00

    ComponentApplicationState is state (data) linked to the component via binding expressions. It unique to a component. Only that component can access the state values.

    Fluxor is based on flux/react pattern of react, and gives a global state. Any component can update the state or bind to the state values

    Session storage is browser storage (database) the is deleted when the browser session ends.

    Local storage is browser storage (database) that is preserved between sessions.

    0 comments No comments

  3. Tobias Lie-Atjam 1 Reputation point
    2021-10-05T14:10:11.527+00:00

    Seems like "ComponentApplicationState" is removed from 'Microsoft.AspNetCore.Components.

    After updating i can not find it anywhere...

    The type or namespace: ComponentApplicationState could not be found....

    Any idea why it's removed?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.