function getState(state, props) {
  if (!state || !props) {
    return state
  }

  return Object.keys(state).reduce((prevState, key) => {
    prevState[key] = isControlledProp(props, key) ? props[key] : state[key]

    return prevState
  }, {})
}
This will perform a shallow merge of the given state object
with the state coming from props
(for the controlled component scenario)
This is used in state updater functions so they're referencing
the right state regardless of where it comes from.

@param {Object} state The state of the component/hook.
@param {Object} props The props that may contain controlled values.
@returns {Object} The merged controlled state.