answer:
const setParentAsActive = (node: any) => {
if (node) {
node.parentNode.className = node.className
answer:
const setParentAsActive = (node: any) => {
if (node) {
node.parentNode.className = node.className
As of NPM 5, saving is done by default
--save-dev is only needed if we’re building a node app;
since we output minified JS for production via npm run build, everything is a dev dependency,
so it doesn’t actually matter in practice whether modules are added to dependencies or devDependencies in package.json.
Why closing a page does not unmount the component
Closing the page will actually discard the main process/thread which handles the rendering of the web page. In that case,
there is actually no way of calling the unmounting method since the thread which calls that method is discarded.
prepare
const httpCodeFetch = async ({ url, config = initialConfig }) => {
const res = await fetch(url, config)
if (res.status === 204) return {}
if (res.ok) {
return res.json()
const App = () =>{ | |
const [conunt,setConunt] = useState(1) | |
return ( | |
<div> | |
{Array(conunt).fill(<RepeatCompnent/>)} | |
</div> | |
) | |
} |
function blobToDataURI(blob, callback) { | |
const reader = new FileReader() | |
reader.readAsDataURL(blob) | |
reader.onload = function (e) { | |
callback(e.target.result) | |
} | |
} |
yarn add -D tailwindcss twin.macro autoprefixer babel-plugin-macros styled-components
import React from 'react' | |
import ReactDOM from 'react-dom' | |
import { StoreContext } from 'redux-react-hook' | |
import App from './App' | |
import store from './store/configureStore' | |
import prestate from './store/prestate' | |
const app = (state = {}) => { | |
ReactDOM.render( |
#!/bin/sh | |
git filter-branch --env-filter ' | |
OLD_EMAIL="要修改的email" | |
CORRECT_NAME="正確的user.name" | |
CORRECT_EMAIL="正確的user.email" | |
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] |
npm install @storybook/react --save-dev
npm install @storybook/addons @storybook/addon-actions @storybook/addon-knobs @storybook/addon-notes --save-dev