Hello everyone, I’m trying to create a function to generate id. For Example 1, 2, 3, … so on Not UUID. Just simple number.
In JS we can write a function like following to achieve this
function () {
let count = -1
return {
getNext: () => {
count = count + 1
return count
}
}
}
how can we achieve something similar in elm. I tried to look into Random module to see how random keeps track of state but i dont understand anything.
Can somebody help me?. I have a solution to keep a counter in the state and keep incrementing. Is it the right way to do it. Or is there a better way ?