Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fenextjs-hook

Package Overview
Dependencies
Maintainers
1
Versions
264
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fenextjs-hook

Hook of Fenextjs

  • 1.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
413
increased by57.03%
Maintainers
1
Weekly downloads
 
Created
Source

fenextjs-hook

Hook of Fenextjs

useData

Hook for handling Data Object

//for CJS
import { useData } from "fenextjs-hook/cjs/useData";
//for ESM
import { useData } from "fenextjs-hook/esm/useData";

//interface of value
interface ValueProps {
    //....
}
//interface of value Memo(optional)
interface ValueMemoProps {
    //....
}
const {
    data, // value
    onChangeData, // change one value by key
    isChange, // boolean if change data
    setData, // set value
    dataMemo, // data parse by onMemo
    setIsChange, // set isChange
} = useData<
    ValueProps, // intefate of value
    ValueMemoProps //interface of value Memo(optional)
>(
    defaultValue, // default value
    {
        //function execute after change value
        onChangeDataAfter: (data: ValueProps) => {

        },
        //function execute for parse data to dataMemo
        onMemo: (data: ValueProps) => {
            const dataMemo : ValueMemoProps = {
                //...
            }
            return dataMemo
        };
    }
);

useRequest

Hook for request, loader and errors, with query and autoRequest

//for CJS
import { useRequest } from "fenextjs-hook/cjs/useRequest";
//for ESM
import { useRequest } from "fenextjs-hook/esm/useRequest";

//interface of query
interface QueryProps {
    //....
}
//interface of result
interface ResultProps {
    //....
}
//interface of error
interface ErrorProps {
    //....
}
const {
    result, // result of request,
    loader, // boolean of loader,
    error, // error failing the request
    onRequest, // function request,
} = useRequest<
    QueryProps, // intefate of query
    ResultProps, //interface of result
    ErrorProps //interface of error Request(optional)
>({
    query, // query by use in request
    request, // function request
    autoRequest, // boolean if auto execute request is change query (optional)(default = false)
});

useModal

Hook to save modal settings to localstorage using uselocalstoragenextjs

//for CJS
import { useModal } from "fenextjs-hook/cjs/useModal";
//for ESM
import { useModal } from "fenextjs-hook/esm/useModal";

//inteface of content valueModal
interface useModalConfigContentProps {
    key: string; // key of config modal
    data: any; // config modal
}
//inteface of valueModal
interface useModalConfigProps {
    active?: boolean; // if active modal
    use?: boolean; // if use modal in current page
    loader?: boolean; // if loader modal
    content?: useModalConfigContentProps[]; // content config modal
}

const {
    valueModal, // value of config modal, inteface useModalConfigProps
    loadModal, // boolean if load modal
    updateModal, // update one value of config modal by key
    setModal, // set value of config modal, inteface useModalConfigProps
} = useModal();

useNotification

Hook to save notification settings to localstorage using uselocalstoragenextjs

//for CJS
import { useNotification } from "fenextjs-hook/cjs/useNotification";
//for ESM
import { useNotification } from "fenextjs-hook/esm/useNotification";

//type of notification
type NotificationType = "none" | "normal" | "ok" | "error" | "warning";

//iterfate of notification
interface NotificationProps {
    type?: NotificationType;
    message: string;
}
const {
    loadNotification, // boolean if load notification,
    notification, // value of notification, interface NotificationProps
    pop, // function of add notification by time
    reset, // reset notification (remove)
} = useNotification({
    time: 2000, // time of show notification (optional)(default = 2000)
});

useQuery

Hook for handling Query Router

//for CJS
import { useQuery } from "fenextjs-hook/cjs/useQuery";
//for ESM
import { useQuery } from "fenextjs-hook/esm/useQuery";

const {
    query, // query value, interface useQuery_QueryProps
    setQuery, // set query value
    onChangeQuery, // change one query value by key
    isChange, // boolean if change query
} = useQuery();

Developer

Francisco Blanco

Gitlab franciscoblancojn

Email blancofrancisco34@gmail.com

Repositories

  • Gitlab

Keywords

FAQs

Package last updated on 28 Jan 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc