
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@ki2/react-front-utils
Advanced tools
React hooks and utilities functions.
This react-front-utils package is an opinionated package.
It select some usefull modules and re-export them to centrilize
commonly used features.
clxFunction used to merge classnames (see clsx or classnames packages)
nanoidFunction to generate a short id. It's a fast alternative to uuid.
Exported function :
nanoid : base function (safe & synchronous call)async_nanoid : asynchronous functionunsafe_nanoid: unsafe function (synchronous)See nanoid package for more informations.
qs (query-string)Export the query-string package into qs object.
YAMLExport the js-yaml package into YAML object.
It's used almost like the JSON object.
useInstanceAllow to properly create a class instance.
Usage:
const store = useInstance(() => new MyClass());
useInterval(callback, delay)Allow to regularly (every delay milliseconds) call a callback function (defined in a component).
function doSomething() {
// do something here every second
}
useInterval(doSomething, 1000);
The callback function may only use a stop function as an argument allowing to stop futur calls.
function doSomething(stop){
// do something here every second
if (/* some condition */){
stop(); // stop interval
}
}
useInterval(doSomething, 1000)
useScrollPositionParameters:
effect : function called every time the scroll change (or if any deps dependency is changed);deps : external dependency of the effect function (optional);element : element in which the scroll position is tracked (optional);useWindow [boolean]: force to use full window instead of an element (optional)wait [number]: number of milliseconds to wait before the effect function is called again (optional).The effect function take 2 parameters : the current scroll position (currPos) and the previous scroll position (prevPos, from the previous call).
A position (currPos or prevPos) is an object contaning x and y positions (scroll from x and y axis respectively).
Usage (example) :
const [hide, setHide] = useState(true);
useScrollPosition(
(curr, prev) => {
const isHide = curr.y < 250;
if (isHide !== hide) {
setHide(isHide);
}
},
[hide],
contentRef // Reference to the content we looking for
);
downloadThe download function allow to download a locally generated file. The content is writed into a string object and browser download it as a file. The file name is given by the first filename parameter.
function download(filename: string, content: string);
generateNextGenerate a path with the search string.
function generateNext(pathname: string, search?: string): string;
getNextExtract the next parameter from query string.
interface INextReturn {
pathname: string;
search?: string;
}
function getNext(search?: string): INextReturn;
interface YAMLStringifyOpts {
startWarnMessage?: string;
skipInvalid?: boolean;
}
YAMLStringifyStringify data to YAML (handle errors).
function YAMLStringify(data: any, opts: YAMLStringifyOpts = {}): string;
YAMLParseParse YAML to string (handle errors).
function YAMLParse(data: string, opts: YAMLParseOpts = {}): any;
FAQs
base react hooks & frontend utilities functions
We found that @ki2/react-front-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.