This file contains 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 from 'react' | |
const Store = React.createContext() | |
const useStore = () => React.useContext(Store) | |
const reducer = (state, action) => { | |
switch(action.type) { | |
case 'ADD_TODO': | |
return { ...state, todos: [...state.todos, action.payload] } |
This file contains 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
// @ts-check | |
import { useState, useEffect } from 'react' | |
function getCurrentLocation () { | |
return { | |
pathname: window.location.pathname, | |
search: window.location.search | |
} | |
} |
This file contains 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, {createContext, useEffect, useContext, useReducer} from 'react'; | |
const initialArgs = { | |
count: 0 | |
}; | |
const CounterContext = createContext(initialArgs); | |
function counterReducer(state, action) { | |
switch (action) { |
This file contains 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
'use strict'; | |
const path = require('path'); | |
const webpack = require('webpack'); | |
const PnpWebpackPlugin = require('pnp-webpack-plugin'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); | |
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); | |
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); | |
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); |
This file contains 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 publicPath = 'public'; | |
// Node os module | |
// The os module provides a number of operating system-related utility methods. | |
// It can be accessed using: | |
const os = require('os'); | |
// Using a single monolithic configuration file impacts comprehension and | |
// removes any potential for reusability. | |
// As the needs of your project grow, you have to figure out the means to manage | |
// webpack configuration more effectively. |
This file contains 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
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="redirect all requests" stopProcessing="true"> | |
<match url="^(.*)$" ignoreCase="false" /> | |
<conditions logicalGrouping="MatchAll"> | |
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" /> | |
</conditions> | |
<action type="Rewrite" url="index.html" appendQueryString="true" /> |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>tabs demo</title> | |
<style type="text/css"> | |
.tabs ul { | |
list-style-type: none; | |
margin: 0 2em; | |
padding: 0; | |
cursor: pointer; |