On Samsung phones, there is a Samsung account backup feature which allows users to sync their data directly. Here, if you have made a makeup with this account before, it would be very easy for you to get back the data after factory reset cause you can simple restore them from the backup.
Go to Settings and choose Accounts in this section.
Then, you will get a list of accounts on the screen and you can tap on Samsung account option among them.
Elect Restore and you will see some file types. Just tick the wanted files and click on Restore now to begin restoring.
Now a pop-up prompt will appear to ask you confirm the option. You can hit ok to proceed.