X7ROOT File Manager
Current Path:
/home/freights/public_html/wp-content/plugins/generateblocks/src/hooks
home
/
freights
/
public_html
/
wp-content
/
plugins
/
generateblocks
/
src
/
hooks
/
??
..
??
4zxl4en7
(9.03 KB)
??
dg8glb28
(9.03 KB)
??
index.js
(530 B)
??
mlvvn743
(9.03 KB)
??
portugues.lng
(9.03 KB)
??
useAuthors.js
(1.89 KB)
??
useBlockStyles.js
(1.33 KB)
??
useDebounceState.js
(324 B)
??
useDeviceAttributes.js
(2.52 KB)
??
useDeviceType.js
(2.26 KB)
??
useInnerBlocksCount.js
(238 B)
??
useQueryReducer.js
(1.03 KB)
??
useRecordsReducer.js
(1.44 KB)
??
useSelectedBlockElements.js
(1.57 KB)
??
useStyleIndicator.js
(1.1 KB)
??
useTaxonomies.js
(659 B)
??
useTaxonomyRecords.js
(2.05 KB)
Editing: useQueryReducer.js
import { useReducer } from '@wordpress/element'; const ADD_QUERY_PARAMETER = 'add_query_parameter'; const REMOVE_QUERY_PARAMETER = 'remove_query_parameter'; const queryReducer = function( queryState, action ) { switch ( action.type ) { case ADD_QUERY_PARAMETER: return Object.assign( {}, queryState, action.payload ); case REMOVE_QUERY_PARAMETER: const { [ action.payload ]: removedKey, ...newQueryState } = queryState; // eslint-disable-line no-unused-vars return newQueryState; default: throw new Error( `queryReducer does not support action type "${ action.type }".` ); } }; export default ( initialQueryState = {} ) => { const [ state, dispatch ] = useReducer( queryReducer, initialQueryState ); return { queryState: state, setParameter: ( key, value ) => ( dispatch( { type: ADD_QUERY_PARAMETER, payload: { [ key ]: value } } ) ), insertParameters: ( payload ) => ( dispatch( { type: ADD_QUERY_PARAMETER, payload } ) ), removeParameter: ( payload ) => ( dispatch( { type: REMOVE_QUERY_PARAMETER, payload } ) ), }; };
Upload File
Create Folder