Elm: How to fetch data on page load with Navigation.newUrl? -
i have elm application multiple pages/routes. have "/dashboard" route needs data on page load.
i had modify init
function when user hard browser reload, , had modify update
function's onlocationchange
clause when navigation.newurl
called.
my question is: right way this? hate having modify 2 functions when feels there should 1 place handles this.
i think let update
function handle cmd
creation.
init : navigation.location -> ( model, cmd msg ) init location = update (locationchange location) initialmodel
Comments
Post a Comment