useCallback
This commit is contained in:
@@ -1,24 +1,22 @@
|
||||
'use client'
|
||||
|
||||
import {createContext, useEffect, useState} from "react";
|
||||
|
||||
import {createContext, useCallback, useEffect, useState} from "react";
|
||||
export const TableSettingContext = createContext();
|
||||
|
||||
export const TableSettingProvider = ({children}) => {
|
||||
const [settingStore, setSettingStore] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
const _localStorage = localStorage.getItem("_setting-app")
|
||||
if (_localStorage)
|
||||
if (_localStorage) {
|
||||
setSettingStore(JSON.parse(_localStorage))
|
||||
}
|
||||
}, []);
|
||||
|
||||
const hideAction = (user_id, page_name, table_name, settingValue) => {
|
||||
const hideAction = useCallback((user_id, page_name, table_name, settingValue) => {
|
||||
updateSettingStorage(user_id, page_name, table_name, "hides", settingValue);
|
||||
}
|
||||
const sortAction = (user_id, page_name, table_name, settingValue) => {
|
||||
},[])
|
||||
const sortAction = useCallback((user_id, page_name, table_name, settingValue) => {
|
||||
updateSettingStorage(user_id, page_name, table_name, "sorts", settingValue);
|
||||
}
|
||||
},[])
|
||||
const filterAction = (user_id, page_name, table_name, settingValue) => {
|
||||
updateSettingStorage(user_id, page_name, table_name, "filters", settingValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user