How can i get correct nonce

I use import {getNonce} from ‘@stacks/transactions’ to get nonce, But it often throw ConflictNonceInMempool error.

Another approach would be to make direct API queries with something like get_account_info or get_account_nonces.

Depending on your use case you can locally increment the nonce for subsequent transactions, with up to 25 pending in the mempool before you get a too_much_chaining error.