What you get if you use a published book from a good publisher is an educational tool that has been chosen by editors as worth publishing, where the editors, authors, and internal reviewers have worked together to refine the original work of the authors into better educational tool. In addition, a good publisher will take care to produce a work whose formatting is good for its purposes. Finally, the fact that the authors and publishers make a bit of profit provides additional motivation to them to produce a product that readers will find helpful. (And if they do a good job, they deserve to get paid if the pricing is reasonable.) That doesn’t mean the result of the publishing process is ever perfect, and there are of course some completely free works that don’t come from a publishing house that are also good. However, I feel that the process that produces a published book is more reliable, on average. (This isn’t true for all publishers. I don’t consider Packt a reliable publisher, for example, although I think that some of their books are useful. They have a very low-budget editorial process, afaics.)
The process of curating and refining takes time, so there will always be a time lag given that languages and libraries are changing. Even a book that was just published will be a little bit out of date if there have been recent releases of the language or libraries discussed in the book.
So there’s a tradeoff. The more up-to-date you want your learning resource to be, the fewer options you have. The more you want to be able to trust that you are getting an effective learning resource, the more you may have to put up with out of date bits here and there.
When I’m starting out learning something, I usually like to find a good learning resource–a good published book, usually–and then I supplement it with whatever stuff I can find on the web that will update what’s in the book. On the other hand, if what I want to learn is something that is close to what I already know well, I might just go for whatever I can find on the web. This all comes down to personal choice, though, and cost can play a role.