Below some best practice principles on how to setup and use WhatsApp (by Facebook).
A1. never share any authentication code that someone sends you with any third party – in any app or authentication process;
A2. setup 2FA for your what’s app account as per > https://faq.whatsapp.com/general/verification/using-two-step-verification
A3. enable Chat Backup, under WhatsApp > Settings > Chats > Chat Backup … also test the backup works by tapping on ‘Backup Up Now’;
If you are logged out of WhatsApp and can no longer activate it, your account most likely has been compromised. Upon too many signin attempts WhatsApp will lock your account and display a message of how long you need to wait until you can sign in again… wait until then and attempt to sign in again.
According to WhatsApp all past chats should not be visible to any hacker that may have gained access to your WhatsApp account, as the chat history is only stored on your device. In other words, when the hackers attempt to setup your account on another device, they will not see your previous chats.
However note that any hackers, will have gained access to your contacts (and their details) and most likely will attempt to send them messages.