Encapsulation strategies on 2D materials for field effect transistors and photodetectors