Skip to content

Instantly share code, notes, and snippets.

View pinglinh's full-sized avatar
🥸
hermit

pinglinh pinglinh

🥸
hermit
  • pinglinh corporation
  • Earth
View GitHub Profile
{
"presets": ["env", "react"]
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>React and Webpack4</title>
</head>
<body>
<section id="index"></section>
import React from "react";
import ReactDOM from "react-dom";
const Index = () => {
return <div>Hello React!</div>;
};
ReactDOM.render(<Index />, document.getElementById("index"));
const HtmlWebPackPlugin = require("html-webpack-plugin");
const htmlPlugin = new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
});
module.exports = {
module: {
rules: [
const HtmlWebPackPlugin = require("html-webpack-plugin");
const htmlWebpackPlugin = new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
});
module.exports = {
module: {
rules: [
const HtmlWebPackPlugin = require("html-webpack-plugin");
const htmlWebpackPlugin = new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
});
module.exports = {
module: {
rules: [
@pinglinh
pinglinh / Search.js
Last active March 25, 2018 22:24
Refactoring React components : start
import React from "react";
export class Search extends React.Component {
constructor(props) {
super(props);
this.state = {
value: "",
articles: []
};
@pinglinh
pinglinh / Search.js
Last active March 26, 2018 14:48
Refactoring React components : 1.2
import React from "react";
import SearchResult from "./SearchResult";
export class Search extends React.Component {
constructor(props) {
super(props);
this.state = {
value: "",
articles: []
@pinglinh
pinglinh / Search.js
Created March 26, 2018 15:02
Refactoring React components : 1.3
import React from "react";
import SearchResult from "../SearchResult";
const Search = props => {
return (
<div>
<h1>The Guardian Search App</h1>
<form onSubmit={props.handleSubmit}>
<input
type="text"
@pinglinh
pinglinh / index.js
Created March 26, 2018 15:28
Refactoring React components : Search 1.3.1
import React from "react";
import SearchResult from "../SearchResult";
const Search = props => {
return (
<div>
<h1>The Guardian Search App</h1>
<form onSubmit={props.handleSubmit}>
<input
type="text"