If a data subject consents to the processing of their data, this can be a legal basis. However, the GDPR defines precise conditions for consent (see Art. 7 GDPR):
This shows that data processing on the basis of consent is not necessarily the best solution, especially because it can be revoked by the data subject at any time. However, it is perfectly adequate for simple use cases.
Example: You would like to send a newsletter. By registering for the newsletter, interested parties give you their consent to be informed by e-mail in the future. Anyone who has registered for the newsletter can withdraw their consent at any time by unsubscribing from the newsletter. The technical system of the newsletter tool also provides you with proof of consent.
Source: Muhammad Ribkhan on Pixabay