When you hate both books, do you say ● "I don't like both" or ● "I don't like either" ?
Both are perfectly grammatical but mean different things.
Both is an odd word: it is one of few English words that is still dual, which is to say that it refers collectively to two entities--no more and no less. Either also refers to two entities, but it does so individually. Take the following example:
Both men are here.
Either man is here.
You will have noticed that, in both cases, there is the implication of two men being in question; however, you will also have noticed that the first sentence gives explicit reference to both of them, whereas the second only gives such reference to one. The second sentence alerts us of two men's existence, but quietly lets us know that only one of them is present.
With this is mind, let us move on to your question:
I don't like both.
I don't like either.
The first sentence means that you dislike the two things collectively; as such, each on its own may or may not be likable, or perhaps one is likable but the other is not. The second sentence means that you dislike the two things individually, which precludes liking one but not the other.