-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
642fd59
commit 4f263de
Showing
15 changed files
with
1,040 additions
and
67 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "@react-hooks-issue/spa", | ||
"version": "1.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "NODE_ENV=development webpack-dev-server --mode development --host 127.0.0.1" | ||
}, | ||
"dependencies": { | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1", | ||
"styled-components": "^5.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^16.9.25", | ||
"@types/react-dom": "^16.9.5", | ||
"html-webpack-plugin": "^4.0.1", | ||
"ts-loader": "^6.2.2", | ||
"typescript": "^3.8.3", | ||
"webpack": "^4.42.1", | ||
"webpack-cli": "^3.3.11", | ||
"webpack-dev-server": "^3.10.3" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>SPA</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React, { Fragment } from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
import { Example } from '@react-hooks-issue/uikit'; | ||
|
||
ReactDOM.render(<Fragment> | ||
<Example /> | ||
</Fragment>, document.getElementById('root')); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "./dist/", | ||
"sourceMap": true, | ||
"noImplicitAny": true, | ||
"esModuleInterop": true, | ||
"module": "commonjs", | ||
"target": "es6", | ||
"jsx": "react" | ||
}, | ||
"include": [ | ||
"src/**/*" | ||
], | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const { resolve } = require('path'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
|
||
module.exports = { | ||
devtool: 'source-map', | ||
|
||
resolve: { | ||
extensions: ['.ts', '.tsx', '.js', '.json'], | ||
}, | ||
|
||
entry: resolve(__dirname, 'src', 'index.tsx'), | ||
|
||
output: { | ||
path: resolve(__dirname, 'dist'), | ||
filename: '[name].[hash].js', | ||
publicPath: '/', | ||
}, | ||
|
||
optimization: { | ||
splitChunks: { | ||
chunks: 'all', | ||
minChunks: 1, | ||
}, | ||
}, | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts(x?)$/, | ||
exclude: /node_modules/, | ||
use: [ | ||
{ | ||
loader: 'ts-loader', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
|
||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
template: resolve(__dirname, 'src', 'index.html'), | ||
filename: 'index.html', | ||
inject: 'body', | ||
}), | ||
], | ||
|
||
devServer: { | ||
historyApiFallback: 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React, { FunctionComponent, useState } from 'react'; | ||
|
||
const Example: FunctionComponent = () => { | ||
const [counter, setCounter] = useState(0); | ||
|
||
return <div> | ||
<button onClick={() => setCounter(counter - 1)}>-</button> | ||
<span>{counter}</span> | ||
<button onClick={() => setCounter(counter + 1)}>+</button> | ||
</div>; | ||
}; | ||
|
||
export default Example; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as Example } from './Example'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from './components/Faq'; | ||
export * from './components/Example'; |
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
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
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
Oops, something went wrong.