PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / trunk
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce vtrunk
3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.21 All 160 releases
cartflows / wizard / assets / src / utils / StateProvider.js

StateProvider.js in CartFlows – Funnel Builder & Checkout Plugin for WooCommerce trunk, at wizard/assets/src/utils/StateProvider.js

15 lines 475 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React, { createContext, useContext, useReducer } from 'react';
2
3 // Prepare a dataLayer
4 export const StateContext = createContext();
5
6 // Wrap our app and provide the Data layer
7 export const StateProvider = ( { reducer, initialState, children } ) => (
8 <StateContext.Provider value={ useReducer( reducer, initialState ) }>
9 { children }
10 </StateContext.Provider>
11 );
12
13 // Get information from the data layer
14 export const useStateValue = () => useContext( StateContext );
15