useBattery hook not working when run on local network
kriptonian1 opened this issue · comments
Sawan Bhattacharya commented
useBattery hook is throwing null for everything, when I am using running the nextjs app with local net workwork npm run dev -- -H <ip_from_ifconfig>
Code
import { useBattery } from "@uidotdev/usehooks";
import React from "react";
// import { AnimatePresence, motion } from "framer-motion";
function Battery(): React.JSX.Element {
const { loading, level, charging, chargingTime, dischargingTime } =
useBattery();
const percentage: number = level !== null ? Math.floor(level * 100) : 100;
console.log(
`Battery: ${percentage}% level: ${level} charging: ${charging} chargingTime: ${chargingTime} dischargingTime: ${dischargingTime} loading: ${loading}`,
);
.....