useThemeContext(); should be used in the client page so you need wrap the your button in to client componant ... then it will work
useThemeContext();