React passes state-setting functions a callback with an argument that contains the previous state, so I know you should probably use the previous state when updating a state