Check out example codes for "magento 2 The requested class did not generate properly, because the 'generated' directory permission is read-only". It will help you in understanding the concepts better.

Code Example 1

sudo chown -R youruser:www-data /generated

Learn ReactJs, React Native from akashmittal.com