I used the parent states name for some utility purposes, the problem is when trying to retrieve it from a child state as it returns an object with the parents state value as the object key.
Below is the code to get the value when in the parent state:
console.log(this.state.value);
// "start_application"
This returns a string value.
When in a child state it returns the following:
console.log(this.state.value);
// {
// "customer_data": "no_data"
// }
There are hacks to get the name, like checking if it is an object and then retrieving the object key value but this is awfully hacky (not in a good way :P).
Is there a better way of doing this or am I approaching it completely wrong?
Thanks in advance.