{"version":3,"sources":["reducers/index.js","contexts/appState.js","reducers/counterReducer.js","reducers/randomReducer.js","Counter.js","Random.js","App.js","reportWebVitals.js","index.js"],"names":["initialState","random","value","counter","Context","createContext","AppStateProvider","reducer","children","useReducer","Provider","useAppState","useContext","reducers","counterReducer","state","action","type","randomReducer","randomData","Counter","dispatch","className","onClick","handleCountIncrement","handleCountDecrement","Random","handleRandomData","Math","round","appReducers","Object","keys","reduce","acc","prop","App","reportWebVitals","onPerfEntry","Function","then","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","StrictMode","document","getElementById"],"mappings":"6MAAMA,EAAe,CACnBC,OAAQ,CAAEC,MAAO,GACjBC,QAAS,G,OCCLC,EAAUC,0BAET,SAASC,EAAT,GAAqE,IAAzCC,EAAwC,EAAxCA,QAAwC,IAA/BP,oBAA+B,MAAhB,GAAgB,EAAZQ,EAAY,EAAZA,SACvDN,EAAQO,qBAAWF,EAASP,GAElC,OACE,cAACI,EAAQM,SAAT,CAAkBR,MAAOA,EAAzB,SACGM,IAUA,SAASG,IACd,OAAOC,qBAAWR,GCrBpB,IFKwBS,EEeTC,EApBQ,SAACC,GAAwB,IAAjBC,EAAgB,uDAAP,GAC9BC,EAASD,EAATC,KACR,OAAQA,GACN,IAAK,YACH,OAAO,2BACFF,GADL,IAEEZ,QAASY,EAAMZ,QAAU,IAG7B,IAAK,YACH,OAAO,2BACFY,GADL,IAEEZ,QAASY,EAAMZ,QAAU,IAG7B,QACE,OAAOY,ICFEG,EAdO,SAACH,GAAwB,IAAjBC,EAAgB,uDAAP,GAC7BG,EAAqBH,EAArBG,WAAYF,EAASD,EAATC,KACpB,OAAQA,GACN,IAAK,gBACH,OAAO,2BACFF,GADL,IAEEd,OAAO,2BAAMc,EAAMd,QAAWkB,KAGlC,QACE,OAAOJ,I,cCcEK,EAbC,WAAO,IAAD,EACQT,IADR,mBACZI,EADY,KACLM,EADK,KAEpB,OACE,qCACE,0CAAaN,EAAMZ,WACnB,sBAAKmB,UAAU,UAAf,UACE,wBAAQC,QAAS,kBAdI,SAACF,GAC5BA,EAAS,CAAEJ,KAAM,cAaYO,CAAqBH,IAA5C,eACA,wBAAQE,QAAS,kBAXI,SAACF,GAC5BA,EAAS,CAAEJ,KAAM,cAUYQ,CAAqBJ,IAA5C,sBCDOK,EAVA,WAAO,IAAD,IACSf,IADT,mBACXI,EADW,KACJM,EADI,KAEnB,OACI,sBAAKC,UAAU,SAAf,UACE,mDAAYP,EAAMd,cAAlB,aAAY,EAAcC,SAC1B,wBAAQqB,QAAS,kBATA,SAACF,EAAUnB,GAClCmB,EAAS,CAAEJ,KAAM,gBAAiBE,WAAY,CAAEjB,WAQnByB,CAAiBN,EAAWO,KAAKC,MAAoB,IAAdD,KAAK3B,YAAnE,wCCJF6B,GNHkBjB,EMGY,CAClCV,QAASW,EACTb,OAAQiB,GNJD,SAACH,EAAOC,GACb,OAAOe,OAAOC,KAAKnB,GAAUoB,QAC3B,SAACC,EAAKC,GACJ,OAAO,YAAC,eACHD,GACArB,EAASsB,GAAT,eAAkBA,EAAOD,EAAIC,IAASnB,MAG7CD,KMWSqB,EAZH,WAEV,OACE,cAAC9B,EAAD,CAAkBC,QAASuB,EAAa9B,aAAcA,EAAtD,SACE,sBAAKsB,UAAU,MAAf,UACE,cAAC,EAAD,IACA,cAAC,EAAD,UCPOe,EAZS,SAAAC,GAClBA,GAAeA,aAAuBC,UACxC,6BAAqBC,MAAK,YAAkD,IAA/CC,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,OAAQC,EAA8B,EAA9BA,OAAQC,EAAsB,EAAtBA,OAAQC,EAAc,EAAdA,QAC3DJ,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAON,GACPO,EAAQP,OCDdQ,IAASC,OACP,cAAC,IAAMC,WAAP,UACE,cAAC,EAAD,MAEFC,SAASC,eAAe,SAM1Bb,K","file":"static/js/main.459df027.chunk.js","sourcesContent":["const initialState = {\n random: { value: 0 },\n counter: 0,\n}\n\nconst combineReducers = reducers => {\n return (state, action) => {\n return Object.keys(reducers).reduce(\n (acc, prop) => {\n return ({\n ...acc,\n ...reducers[prop]({ [prop]: acc[prop] }, action),\n })\n },\n state\n )\n }\n}\n\nexport { initialState, combineReducers }\n","import React, { createContext, useReducer, useContext } from 'react'\nimport { object, func } from 'prop-types'\n\nconst Context = createContext()\n\nexport function AppStateProvider({ reducer, initialState = {}, children }) {\n const value = useReducer(reducer, initialState)\n\n return (\n \n {children}\n \n )\n}\n\nAppStateProvider.propTypes = {\n reducer: func,\n initialState: object,\n}\n\nexport function useAppState() {\n return useContext(Context)\n}\n","const counterReducer = (state, action = {}) => {\n const { type } = action\n switch (type) {\n case 'INCREMENT': {\n return {\n ...state,\n counter: state.counter + 1,\n }\n }\n case 'DECREMENT': {\n return {\n ...state,\n counter: state.counter - 1,\n }\n }\n default:\n return state\n }\n}\n\nexport default counterReducer","const randomReducer = (state, action = {}) => {\n const { randomData, type } = action\n switch (type) {\n case 'RANDOM_ACTION': {\n return {\n ...state,\n random: { ...state.random, ...randomData },\n }\n }\n default:\n return state\n }\n}\n\nexport default randomReducer","import './App.css';\nimport { useAppState } from './contexts/appState'\n\nconst handleCountIncrement = (dispatch) => {\n dispatch({ type: 'INCREMENT' })\n}\n\nconst handleCountDecrement = (dispatch) => {\n dispatch({ type: 'DECREMENT' })\n}\n\nconst Counter = () => {\n const [ state, dispatch ] = useAppState()\n return (\n <>\n

Counter: {state.counter }

\n
\n \n \n
\n \n );\n}\n\nexport default Counter;\n","import './App.css';\nimport { useAppState } from './contexts/appState'\n\nconst handleRandomData = (dispatch, value) => {\n dispatch({ type: 'RANDOM_ACTION', randomData: { value }})\n}\n\nconst Random = () => {\n const [ state, dispatch ] = useAppState()\n return (\n
\n

Random: {state.random?.value }

\n \n
\n );\n}\n\nexport default Random;\n","import { initialState, combineReducers } from './reducers'\nimport { AppStateProvider } from './contexts/appState'\nimport counterReducer from './reducers/counterReducer'\nimport randomReducer from './reducers/randomReducer'\nimport './App.css';\nimport Counter from './Counter';\nimport Random from './Random';\n\nconst appReducers = combineReducers({\n counter: counterReducer,\n random: randomReducer,\n})\n\nconst App = () => {\n \n return (\n \n
\n \n \n
\n
\n );\n}\n\nexport default App;\n","const reportWebVitals = onPerfEntry => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport reportWebVitals from './reportWebVitals';\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root')\n);\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""}