What is the difference between functions assign
and update
and which to use when?
I know the update
function will raise an error if the key does not exists, so why not use assign
function everywhere? Probably there are more reasons behind the update, than simply want to make sure that key is present before we update it?
Even in the code, update uses assing: phoenix_live_view/phoenix_live_view.ex at v0.17.5 · phoenixframework/phoenix_live_view · GitHub