This file contains hidden or 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 axios from "axios"; | |
| export function fetchUsers(){ | |
| return function(dispatch){ | |
| axios.get('http://reqres.in/api/users?page=1') | |
| .then((response) =>{ | |
| dispatch({type:'FETCH_USERS_FULFILLED', payload:response.data.data}); | |
| }) | |
| .catch((err) => { |
This file contains hidden or 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
| export default function reducer(state={ | |
| users:[], | |
| fetching: false, | |
| fetched: false, | |
| error: null | |
| }, action){ | |
| switch (action.type) { | |
| case "FETCH_USERS":{ | |
| return {...state, fetching: true} | |
| } |
This file contains hidden or 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 {combineReducers} from "redux"; | |
| import user from "./usersReducer"; | |
| export default combineReducers({ | |
| user | |
| }) |
This file contains hidden or 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 {applyMiddleware, createStore} from "redux"; | |
| //middlewares | |
| import logger from "redux-logger"; | |
| import promise from "redux-promise-middleware"; | |
| import thunk from "redux-thunk"; | |
| import reducers from "./reducers"; | |
| const middleware = applyMiddleware(promise(), thunk, logger()); |
This file contains hidden or 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 ReactDOM from "react-dom"; | |
| import {Provider} from "react-redux"; | |
| //components | |
| import AppComponent from "./components/App.js"; | |
| import store from "./store"; | |
| ReactDOM.render(<Provider store={store}> | |
| <AppComponent /> | |
| </Provider>,document.getElementById("main")); |
This file contains hidden or 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 ReactDOM from "react-dom" | |
| export default class Userlist extends React.Component{ | |
| render(){ | |
| return ( | |
| <div> | |
| UserList Component | |
| </div> | |
| ) |
This file contains hidden or 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 ReactDOM from "react-dom" | |
| import UserList from './UserList.js' | |
| export default class Main extends React.Component{ | |
| render(){ | |
| return ( | |
| <div> | |
| <UserList /> | |
| </div> |
This file contains hidden or 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 ReactDOM from "react-dom"; | |
| //components | |
| import MainComponent from "./components/App.js"; | |
| ReactDOM.render(<MainComponent /> | |
| ,document.getElementById("main")); |
This file contains hidden or 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
| "dependencies": { | |
| "axios": "^0.15.2", | |
| "babel-core": "^6.18.2", | |
| "babel-loader": "^6.2.7", | |
| "babel-plugin-add-module-exports": "^0.2.1", | |
| "babel-plugin-react-html-attrs": "^2.0.0", | |
| "babel-plugin-transform-class-properties": "^6.18.0", | |
| "babel-plugin-transform-decorators-legacy": "^1.3.4", | |
| "babel-polyfill": "^6.9.1", | |
| "babel-preset-es2015": "^6.14.0", |
This file contains hidden or 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 ListViewCustom from 'react-native-recycler-listview'; | |
| constructor(props) { | |
| super(props); | |
| var array = []; | |
| for(var i = 0; i < 1000; i++){ | |
| array.push({"title":"Title","subtitle":"subtiles"}); | |
| } | |
| this.state = { | |
| dataSource:{"names": array} |