Skip to content

Instantly share code, notes, and snippets.

View ncpope's full-sized avatar

Nathan Pope ncpope

View GitHub Profile
@ncpope
ncpope / react-redux-enzyme-test-example.js
Created November 8, 2018 17:15
Testing a redux connected ReactJS component using Jest, Enzyme
import React from 'react';
import { shallow } from 'enzyme';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import Example from './Example';
const middlewares = [thunk]
const mockStore = configureStore(middlewares)
const initialState = {
example: {}
<?php
# File: app\Http\Middleware\CORS.php
# Create file with below code in above location. And at the end of the file there are other instructions also.
# Please check.
namespace App\Http\Middleware;
use Closure;
class CORS {
@ncpope
ncpope / react-native-component.js
Created July 5, 2017 16:47
Example of a reusable react native component that utilizes the react native View, Text, and StyleSheet components.
import React from 'react';
import {StyleSheet, Text, View} from 'react-native';
const ReusableComponent = () => {
return (
<View style={styles.container}>
<Text style={styles.body}>This is a reusable React Native component.</Text>
</View>
);
}