Skip to content

Instantly share code, notes, and snippets.

View alextorn's full-sized avatar

Alexander T alextorn

View GitHub Profile
@alextorn
alextorn / .babelrc
Created October 17, 2017 11:27
require is not defined in react.production.min.js (React 16) in vendor bundle
{
"plugins": [
[
"module-resolver",
{
"extensions": [
".js"
],
"root": [
"."
@alextorn
alextorn / server.js
Created October 16, 2017 14:58
koa-send, react app with react-router
import Koa from 'koa';
import logger from 'koa-logger';
import koaSend from 'koa-send';
import App from 'app/shell/server/App';
function staticMiddleware() {
return async function staticMiddlewareHandler(ctx, next) {
try {
if (ctx.path !== '/') {
return await koaSend(
// Children component, handleClick in props
const BodyOverlay = ({ handleClick }) => (
<div className="body_overlay" onClick={handleClick} />
);
// propType checking
BodyOverlay.propTypes = {
handleClick: PropTypes.func.isRequired
};
import React from 'react';
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';
const Hero = () => (
<div className="hero">
<ReactCSSTransitionGroup
component="div"
className="hero_text"
transitionName="is-loaded"
transitionEnterTimeout={300}