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
const todos = [ | |
{ id: 1, text: "Buy Milk" }, | |
{ id: 2, text: "Pay Bills" }, | |
{ id: 3, text: "Write Article" }, | |
{ id: 4, text: "Sleep Early" } | |
]; |
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
if (document.readyState === "loading") { | |
// Loading hasn't finished yet | |
document.addEventListener("DOMContentLoaded", startup); | |
} else { | |
// `DOMContentLoaded` has already fired | |
startup(); | |
} | |
function startup() { | |
ReactDOM.render( |
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
const Home = ({ pathArr }) => { | |
const [pathInState, setPathFn] = useState(pathArr); | |
storePathInState = setPathFn; | |
return pathInState[0] === "todos" ? ( | |
// If the first part of the url is /todos, show the TodoList component | |
<TodoList todos={todos} pathArr={pathInState} /> | |
) : pathInState[0] === "about" ? ( | |
// If the first part of the url is /todos, show the TodoList component | |
<About /> |
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
function createClickHandler(url) { | |
return ev => { | |
history.pushState({}, undefined, url); | |
storePathInState(url.split("/").slice(1)); | |
ev.preventDefault(); | |
}; | |
} |
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
window.onpopstate = ev => | |
storePathInState(window.location.pathname.split("/").slice(1)); |
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
const TodoList = ({ todos, pathArr }) => { | |
const [first, todoId] = pathArr; | |
return ( | |
<div> | |
<h1>Todos Module</h1> | |
{typeof todoId === "undefined" ? ( | |
<div> | |
<h2>List of todos:</h2> | |
{todos ? ( | |
todos.map(todo => <Todo key={todo.id} todo={todo} />) |
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
<html> | |
<head> | |
<script | |
src="https://unpkg.com/react@16/umd/react.development.js" | |
crossorigin | |
></script> | |
<script | |
src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" | |
crossorigin | |
></script> |
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
/* jshint node:true */ | |
/* eslint-env node */ | |
/* | |
* This will look at the current version of all of your dependencies and update your package.json | |
* with the specific version that you currently have in node_modules. This will save you from the | |
* sadness that is: DEPENDENCY MANAGEMENT | |
* | |
* Place this file in a folder that's a a sibling to your package.json and node_modules | |
* Then simply run: node scripts/package-strict |
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
// Copyright Pristine Initiatives, 2000. No part of this may be - | |
// copied without written consent from Pristine Initiatives. | |
// Please send all bug reports, comments to [email protected] | |
// upd : 12/27/00 m/d/y | |
//globals | |
/* | |
todo : | |
imp >> on uploading change the root to / instead of CalicutShop/ : done | |
*/ |
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
basho --import './package.json' pack -j pack -j 'Object.keys(x.dependencies)' -m x -e 'npm install ${x}@latest' |