Skip to content

Instantly share code, notes, and snippets.

View JasperVercammen's full-sized avatar

Jasper Vercammen JasperVercammen

View GitHub Profile
@JasperVercammen
JasperVercammen / Login.container.jsx
Created August 29, 2017 07:38
Async form handling
import {connect} from 'react-redux';
import {loginUser} from '../../modules/user/actions';
import LoginView from './Login.view';
const mapStateToProps = (state) => ({
isLoggedIn: state.user.isLoggedIn,
error: state.user.error,
errorMsg: state.user.errorMsg,
});
@JasperVercammen
JasperVercammen / Forms.jsx
Created August 29, 2017 07:20
Component based form handling React
import React, {Component} from 'react';
import './home.css';
const FIELDS = [
{name: 'name', type: 'text', validationRule: 'text', isRequired: true},
{name: 'lastname', type: 'text', validationRule: 'text', isRequired: true},
{name: 'dob', type: 'date', validationRule: 'date'},
{name: 'email', type: 'text', validationRule: 'email'},
{name: 'gender', type: 'radio', validationRule: 'gender', values: ['F', 'M']},
];