DEV Community

Discussion on: Advanced Blazor State Management Using Fluxor, part 3 - Effects

Collapse
momboman profile image
MomboMan

Hey Eric,

In this page's code nor the final version in Github, I can't find where the WeatherEffects 'Http' parameter gets set, i.e. who is calling this:

        public WeatherEffects(HttpClient http, IState<CounterState> counterState, ILocalStorageService localStorageService)
        {
            Http = http;
            CounterState = counterState;
            _localStorageService = localStorageService;
        }
Enter fullscreen mode Exit fullscreen mode
Collapse
mr_eking profile image
Eric King Author

The constructor for the effect class is called by the Fluxor library itself. The arguments are fulfilled by the standard Dependency Injection mechanism, by adding services in the Client/Program.cs class. Look in there and you'll see the HttpClient added explicitly, while the rest of the services are provided by the AddFluxor and AddBlazoredLocalStorage methods.

Collapse
momboman profile image
MomboMan

Urgh. Too subtle for this old guy to catch.

Thanks