This commit is contained in:
2019-08-23 00:12:49 +02:00
committed by GitHub
parent c30e9f27a5
commit fd3a2bc24f
94 changed files with 13855 additions and 9269 deletions

View File

@@ -0,0 +1,18 @@
import { useEffect, useState } from 'react';
const useLog = (provider) => {
const [logs, setLogs] = useState([]);
useEffect(() => {
const update = (newLogs) => {
setLogs([...newLogs]);
}
provider.listen(update);
return () => {
provider.unlisten(update);
}
}, []);
return logs;
};
export default useLog;