The examples should work as written - if you can point at the specific one that doesn't - we could take a look.
The change to make it so that the code you have above works as written is very recent, and we will be working on updating all examples to use this (simpler) approach.