replace on state events is practical to use