Skip to content

Instantly share code, notes, and snippets.

View fay-jai's full-sized avatar
✌️

Willson Mock fay-jai

✌️
View GitHub Profile
@fay-jai
fay-jai / display-table.css
Created January 30, 2016 23:02
Using display:table in CSS
.container {
display: table;
}
.container-row {
display: table-row;
}
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("Step 1 (invoked once) => GetDefaultProps");
},
getInitialState: function() {
console.log("Step 2 (invoked once) => GetInitialState");
return { text: "" };
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getInitialState: function() {
return { text: "" };
},
onInputChange: function(e) {
this.setState({ text: e.target.value });
},
@fay-jai
fay-jai / webpack.config.js
Last active March 21, 2016 05:06
Getting started with Typescript, ReactJS, and Webpack
var path = require("path");
var config = {
/*
* app.ts represents the entry point to your web application. Webpack will
* recursively go through every "require" statement in app.ts and
* efficiently build out the application's dependency tree.
*/
entry: ["./src/app.ts"],
@fay-jai
fay-jai / app.ts
Last active March 21, 2016 05:16
Getting Started with Typescript, ReactJS, and Webpack
// Remember to put this file in your src/ directory
import greeting from "./some_module";
console.log(greeting);
@fay-jai
fay-jai / index.html
Created March 21, 2016 05:19
Getting Started with Typescript, ReactJS, and Webpack
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Getting Started with Typescript, ReactJS, and Webpack</title>
</head>
<body>
<script src="build/bundle.js"></script>
</body>
</html>
@fay-jai
fay-jai / some_module.ts
Last active March 21, 2016 05:21
Getting Started with Typescript, ReactJS, and Webpack
// Remember to put this file in your src/ directory
const greeting: string = "Hello World!";
export default greeting;
@fay-jai
fay-jai / tsconfig.json
Created March 21, 2016 05:55
Getting Started with Typescript, ReactJS, and Webpack
{
"compilerOptions": {
"jsx": "react",
"module": "commonjs",
"noImplicitAny": true,
"outDir": "./build/",
"preserveConstEnums": true,
"removeComments": true,
"target": "ES5"
},
@fay-jai
fay-jai / Hello.tsx
Created March 21, 2016 06:06
Getting Started with Typescript, ReactJS and Webpack
// Remember to rename your file to Hello.tsx and
// place it within your src/ directory
import * as React from "react";
interface HelloProps {
name: string;
}
class Hello extends React.Component<HelloProps, {}> {
@fay-jai
fay-jai / app.tsx
Created March 21, 2016 06:19
Getting Started with Typescript, ReactJS, and Webpack
// Remember to rename the file from app.ts to app.tsx
// and to keep it in the src/ directory.
import * as React from "react";
import * as ReactDOM from "react-dom";
import Hello from "./Hello";
ReactDOM.render(
<Hello name="Willson" />,
document.getElementById("root")