Jetpack navigation with bottom navigation view

Implemented the jetpack navigation library with Bottom navigation view with 5 tabs. The problem now is whenever the bottom tab is clicked, each fragment is re created every time. I want a solution where fragments are kept in memory when the tab is selected the second time.
How to prevent the fragments on those 5 tabs to be re-created but not the nested fragments that opens as detailed fragment from within tabs.

Basically, bottom navigation view like Youtube with navigation library.

I have not used that particular combination, so I do not have a definitive answer for you.

I am not aware of a way to tell the Navigation component to keep fragments around, though, so my guess is that you will need to not use the Navigation component for this particular portion of the app.