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
// Child.jsx | |
class Child extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return ( | |
<button | |
type="button" | |
onClick={ this.props.updateParent } |
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
class Modal extends Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
const node = document.getElementById(‘modal’); | |
return ReactDOM.createPortal(this.props.children, node); | |
} | |
} |
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
class Info extends Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return <Modal><Text text=“This is the text” /></Modal>; | |
} | |
} |
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
class Child extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
error: false | |
}; | |
this.handleClick = this.handleClick.bind(this); | |
} |
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
/* Demo webpack config for a production build | |
This setup can be further combined with tree-shaking and async code splitting for best results */ | |
const path = require('path'), | |
webpack = require('webpack'), | |
buildPath = '../public/assets/js/builds/', | |
ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
module.exports = [{ |
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
module.exports = { | |
entry: './js/src/app.js', | |
output: { | |
filename: './js/build/bundle.js' | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.jsx?$/, | |
loader: 'babel', |
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, { Component } from 'react'; | |
import { Field, reduxForm } from 'redux-form'; | |
import { connect } from 'react-redux'; | |
import * as actions from '../../actions'; | |
const form = reduxForm({ | |
form: 'ReduxFormTutorial', | |
validate | |
}); |
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
var debug = process.env.NODE_ENV !== "production"; | |
var webpack = require('webpack'); | |
module.exports = { | |
context: __dirname, | |
devtool: debug ? "inline-sourcemap" : null, | |
entry: "./js/scripts.js", | |
output: { | |
path: __dirname + "/js", | |
filename: "scripts.min.js" |
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
<!-- Inject via regular symbol --> | |
<% content_for :css do %> | |
<%= stylesheet_link_tag "shop" -%> | |
<% end %> | |
<!-- Inject via controller symbol | |
<%= stylesheet_link_tag params[:controller] %> |