Sometimes you may want to pass the setter from useQueryParams to some kind of event handler which supplies more args than necessary. e.g. onClick={(value, otherStuff) => setQueryParam(value)} but you instead do onClick={setQueryParam}. The setter will interpret that second argument as the updateType which could cause problems. Really, this is a problem in the user code, but in v1 this wasn't a problem, so I'm putting in a defensive check to ensure updateType is a string before calling startsWith on it.
Sometimes you may want to pass the setter from useQueryParams to some kind of event handler which supplies more args than necessary. e.g.
onClick={(value, otherStuff) => setQueryParam(value)}
but you instead doonClick={setQueryParam}
. The setter will interpret that second argument as the updateType which could cause problems. Really, this is a problem in the user code, but in v1 this wasn't a problem, so I'm putting in a defensive check to ensure updateType is a string before callingstartsWith
on it.