There are multiple ways we can do that and also depends on which smart contract is implemented.
1. If we have SC that has IERC721Enumerable
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/cont… implemented that this is not a big problem as there is tokenOfOwnerByIndex method that gets you which IDs of tokens an address has based on index. You first need to get number of tokens an address has with balanceOf and then you can iterate them and get all the IDs of tokens with tokenOfOwnerByIndex. The problem with this is that using this library makes SC and transactions much more expensive, like 2x more as much more storage is used.So many contracts don't implement this library.
2. If we don't have IERC721Enumerable then we need some outside solutions like first could be using and reading onchain events for tokens transfer by a particular address. You can find a script for that here https://github.com/adriadrop/erc721-list you could also make and deploy SubGraph on TheGraph network and read that there with GraphQL
3. We can use hosted solutions like Moralis that get you NFT info from blockchain https://docs.moralis.io/reference/getwalletnfts or we can get it from rarible API
https://multichain-api.rarible.org/v0.1/tag/item-controller#operation/g…and there is also
https://docs.nftport.xyz/docs/nftport/b3A6MjE0MDYzNzM-retrieve-nf-ts-ow…that provides this.
I like to use this kind of data to show end user a better minting experience, so he gets visually the NFTs that he minted on Mint page.