Check out example codes for "yarn latest version". It will help you in understanding the concepts better.

Code Example 1

// amazing simple tool for NodeJs Developer

yarn add natural-utility -S

Code Example 2

curl -o- -L https://yarnpkg.com/install.sh | bash

Code Example 3

choco install yarn

Learn ReactJs, React Native from akashmittal.com