codesplinta / busser Goto Github PK
View Code? Open in Web Editor NEWA robust, opinionated, UI state flow management option for scalable and precise communication across ReactJS Components
License: MIT License
A robust, opinionated, UI state flow management option for scalable and precise communication across ReactJS Components
License: MIT License
I was unable to locate the package on npm, is it out of npm registry?
Or it's has been removed?
There is need to implement a
usePreviousRoute()
hook that works with both NextJS and ReactJS.
import {
useLocation
} from "react-router-dom-v5-compat";
import { useRouter } from "next/router";
import { useRef } from "react";
export const usePreviousRoute = () => {
const isReactRouterDOMRouting = typeof useLocation === "function";
const useBrowserRouter = isReactRouterDOMRouting ? useLocation : useRouter;
const router = useBrowserRouter();
const ref = useRef(null);
useEffect(() => {
() => {
ref.current = router.key ? router.pathname : router.asPath
}
}, [location.key])
if ("on" in (router.events || {})) {
router.events.on("routeChangeStart", () => {
ref.current = router.asPath;
});
}
return ref.current;
};
v0.1.2
There is need to implement a
useHistoryRouter()
hook that works with both NextJS and ReactJS.
import {
useHistory
} from "react-router-dom";
import {
useNavigate
} from "react-router-dom-v5-compat";
import { useRouter } from "next/router";
const useHistoryRouter = () => {
const isReactRouterDOMRouting = typeof useHistory === "function";
const useBrowserRouter = isReactRouterDOMRouting ? useHistory : useRouter;
const router = useBrowserRouter();
const navigator = typeof useNavigate === "function" ? useNavigate() : null;
return {
navigateTo (urlPath) {
if (navigator !== null) {
return navigate(urlPath)
} else {
return router.push(urlPath);
}
},
get pathname () {
if (Boolean(router.location)) {
return router.location.pathname;
} else {
return router.pathname;
}
},
get state () {
if (Boolean(router.location)) {
return router.location.state;
} else {
return null;
}
},
get search () {
if (Boolean(router.location)) {
const searchParams = new URLSearchParams(
router.location.search
);
return Object.fromEntries(
searchParams.entries()
);
} else {
return router.query;
}
},
navigateBack () {
if (typeof router.back === "function") {
router.back();
} else {
router.goBack();
}
},
reload () {
if (typeof router.reload === "function") {
return router.reload();
} else {
return router.location.reload()
}
}
};
};
v0.1.2
package deprecation when installing react-busser
This deprecation has to do with rollup-terser lib
What kind of issues did you encounter with busser?
All packages used are expected to be compatible in subsequent release
busser latest release
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.