PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 3.1.4
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v3.1.4
3.3.0 3.2.1 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 All 162 releases
cartflows / wizard / assets / src / utils / StateProvider.js

StateProvider.js in CartFlows – Funnel Builder & Checkout Plugin for WooCommerce 3.1.4, 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