This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, applyMiddleware } from 'redux'; | |
const reducer = (state = {}, action) => { | |
switch (action.type) { | |
case 'ACTION_1': { | |
return state; | |
} | |
case 'ACTION_2': { | |
return state; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, combineReducers } from 'redux'; | |
const cartState = { | |
products: [], | |
amount: 0 | |
} | |
const cart = (state = cartState, action) => { | |
switch (action.type) { | |
case 'ADD_TO_CART': { | |
const products = [...state.products, action.product]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// install redux from npm `npm install redux --save` | |
import { createStore } from 'redux'; | |
const initialState = { | |
counter: 0 | |
} | |
const reducer = (state = initialState, action) => { | |
switch (action.type) { | |
case 'INC': { | |
const counter = state.counter + action.data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, combineReducers, applyMiddleware } from 'redux'; | |
const initialState = { | |
loading: false, | |
list: [] | |
}; | |
const userReducer = (state = initialState, action) => { | |
switch(action.type) { | |
case 'ADD_USER': { | |
const list = [...state.list]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const products = [ | |
{ | |
"id": "91c9f4a3-18e9-4263-8cd6-c649dabd7e51", | |
"name": "Sauce - Hoisin", | |
"quantity": 35, | |
"image": "https://picsum.photos/200/200/?image=18", | |
"price": 239 | |
}, | |
{ | |
"id": "837d97f1-daa4-4cf3-a933-ef4de0a367f7", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { | |
View, | |
Button, | |
Text, | |
Image, | |
AsyncStorage | |
} from 'react-native'; | |
import { StorageKeys } from './config/constants'; | |
import { Permissions, Notifications, Constants } from 'expo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import RootNavigator from './src/Navigator'; | |
export default class App extends React.Component { | |
render() { | |
return <RootNavigator /> | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { | |
StyleSheet, Text, View, ScrollView, Platform, | |
FlatList, | |
Button, | |
Dimensions, | |
ActivityIndicator | |
} from 'react-native'; | |
// import Button from './src/Button'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1. https://www.linkedin.com/developer/apps - create you app here | |
//2. The OAuth2.0 redirect_uri can be any web url, this needs to be the same there as well as below | |
//This codebase simply fetches you the token, with which you can further get user details from. This is NOT an app fetching the user details. | |
// There is also no error handling, failure redirect etc, you can implement that easily as we have done the success part below. | |
// The below code uses the module `querystring`(`yarn add querystring`) to parse the querystring, you can use anything else you would like | |
import React from 'react'; | |
import { StyleSheet, Text, View, WebView } from 'react-native'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, combineReducers, applyMiddleware } from 'redux'; | |
import thunkMiddleware from 'redux-thunk'; | |
const usersInitialState = { | |
loading: false, | |
counter: 0, | |
list: [] | |
} | |
const userReducer = (state = usersInitialState, action) => { | |
switch (action.type) { |
NewerOlder