Changed to use state to hide layer

Changed to use state to hide layer