Add ability to remove/reset state back to null

As mentioned in #2572, replaceState(null) should set the state of component back to null.