For this check the below tutorial: https://www.sharepointsky.com/sharepoint-framework-client-web-part/