Skip to content

Instantly share code, notes, and snippets.

View Manntrix's full-sized avatar
🏠
Working from home

React Developer Manntrix

🏠
Working from home
View GitHub Profile
@Manntrix
Manntrix / app.js
Created May 1, 2020 05:04
render return
<div>
<AliceCarousel
items={this.state.galleryItems}
responsive={this.responsive}
autoPlayInterval={2000}
autoPlayDirection="rtl"
autoPlay={true}
fadeOutAnimation={true}
mouseTrackingEnabled={true}
disableAutoPlayOnAction={true}
import React, {Component} from 'react';
import axios from 'axios'
import AliceCarousel from 'react-alice-carousel';
import "react-alice-carousel/lib/alice-carousel.css";
import './App.css';
export default class App extends Component {
constructor(props, context) {
super(props, context);
.alice-carousel ul li img{
height: 400px;
width: 100%;
object-fit: cover;
}
import {createStore, applyMiddleware} from 'redux'
import thunk from 'redux-thunk'
import {composeWithDevTools} from 'redux-devtools-extension'
import rootReducer from './reducers'
const initalState = {
}
import { combineReducers } from 'redux'
import userReducer from './usersReducer'
export default combineReducers({
users: userReducer
})
export const GET_USERS = 'GET_USERS';
export const USERS_ERROR = 'USERS_ERROR'
import {GET_USERS} from '../types'
const initialState = {
users:[],
loading:true
}
export default function(state = initialState, action){
switch(action.type){
import {GET_USERS, USERS_ERROR} from '../types'
import axios from 'axios'
export const getUsers = () => async dispatch => {
try{
const res = await axios.get(`http://jsonplaceholder.typicode.com/users`)
dispatch( {
type: GET_USERS,
payload: res.data
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import store from './store/store'
import {Provider} from 'react-redux';
ReactDOM.render(
<React.StrictMode>
import React, { Component } from 'react'
import {connect} from 'react-redux'
import {getUsers} from '../store/actions/usersAction'
class users extends Component {
componentDidMount(){
this.props.getUsers()
}
render() {