Check out example codes for "silk touch spawner". It will help you in understanding the concepts better.

Code Example 1

Spawners cannot be obtained in Survival, even with Silk Touch. -Wiki

Learn ReactJs, React Native from akashmittal.com