You can’t the way you have attempted but technically yes, you can have a function that returns the desired state you want initialised in your constructor.
Can I set function in state?
You can’t the way you have attempted but technically yes, you can have a function that returns the desired state you want initialised in your constructor.