“1” is the user’s id, so I can’t predict what this will be in advance. How do I access the metas from this? In Ruby I would just call state.leaves.first.metas or state.leaves[0].metas. What’s the equivalent for Elixir?
Thanks in advance! Searched all over and couldn’t find how to do it, even converting it to a List and calling List.first…
Edit: Got this to work, but is there a simpler way?
In Elixir Maps aren’t ordered so there is no concept of a first element in a Map.
So which element is “first” when the Map is converted to a list is dependent on the underlying implementation which can change in the future. So retrieving it is only safe if there is only one element in the map.