dworthen / blazorrealm Goto Github PK
View Code? Open in Web Editor NEWRedux state management for https://blazor.net.
Home Page: https://dworthen.github.io/BlazorRealm/docs/quickstart.html
License: MIT License
Redux state management for https://blazor.net.
Home Page: https://dworthen.github.io/BlazorRealm/docs/quickstart.html
License: MIT License
Hi, I have 3 trees of data that I get from 3 api endpoints and a paged list of data based on criteria selected in the trees. The trees also need to load their branches on demand. When you make a selection criteria in one tree it needs to update the other 2 and reload the paged list.
When I page all 4 components reload, to try to resolve this I split the store to test
services.AddRealmStore(new State1(), Reducers.1RootReducer);
services.AddRealmStore(new State2(), Reducers.2RootReducer);
services.AddRealmStore(new State3(), Reducers.3RootReducer);
1RealmStoreBuilder.UseRealmAsync();
2RealmStoreBuilder.UseRealmAsync();
2RealmStoreBuilder.UseRealmAsync();
This resolved the refresh problem and all panels updated independently however I need to be able to use more than one store in the components.
Do you have any suggestions as to the best way to proceed.
Thanks,
Ian
You can upgrade to version 3.1.0-preview1.19508.20?
Layout is inherited from LayoutComponentBase, so it can't be inherited from RealmComponent. What if I want to put some logic in layout's code behind that depends on the state?
This is how I can create conditional HTML using State.
@inherits LayoutComponentBase
<RealmStateContainer TState="WebState" Context="store">
<ComponentTemplate>
@{
WebState State = store.GetState();
Action<IRealmAction> Dispatch = store.Dispatch;
}
@if (State.User == null)
{
<LayoutView Layout="@typeof(PublicTemplate)">@Body</LayoutView>
}
else
{
<LayoutView Layout="@typeof(PrivateTemplate)">@Body</LayoutView>
}
</ComponentTemplate>
</RealmStateContainer>
How can I access State
in the @code section?
@code
{
protected override async Task OnAfterRenderAsync(bool setup)
{
if (setup)
{
if (State.User == null) // ???
{
navigationManager.NavigateTo("sign-in");
}
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.