React to identity changes

why not `switch` case? Looks more readable.