# cartflows/3.1.4/wizard/assets/src/utils/StateProvider.js

CartFlows – Funnel Builder &amp; Checkout Plugin for WooCommerce, version 3.1.4. 15 lines.

- Page: https://pluginprobe.com/plugins/cartflows/3.1.4/code/wizard/assets/src/utils/StateProvider.js
- Raw: https://pluginprobe.com/plugins/cartflows/3.1.4/raw/wizard/assets/src/utils/StateProvider.js
- Modified: 2022-07-06T12:25:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/cartflows/3.1.4/code/wizard/assets/src/utils/StateProvider.js#L10-L20`.

```javascript
import React, { createContext, useContext, useReducer } from 'react';

// Prepare a dataLayer
export const StateContext = createContext();

// Wrap our app and provide the Data layer
export const StateProvider = ( { reducer, initialState, children } ) => (
	<StateContext.Provider value={ useReducer( reducer, initialState ) }>
		{ children }
	</StateContext.Provider>
);

// Get information from the data layer
export const useStateValue = () => useContext( StateContext );

```
