在 npm run deploy 之后,我在 Github 上遇到了类似上面Repo 的错误
我正在尝试在 Github 上的 gh-pages 上部署我的 react-app (create-react-app)
'gh-pages' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hello-world-4@0.1.0 deploy: `npm run build&&gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hello-world-4@0.1.0 deploy script 'npm run build&&gh-page
s -d build'.
npm ERR! Make sure you have the latest …
Run Code Online (Sandbox Code Playgroud) 我有 React 组件。最初我在 UseEffect 中设置了一些 localStorage。此外,我添加了事件侦听器。单击文本后,它会更改 localStorage 值,但事件侦听器没有触发,为什么?
import React, { useEffect } from "react";
export default function App() {
useEffect(() => {
window.localStorage.setItem("item 1", 'val 1');
window.addEventListener('storage', () => {
alert('localstorage changed!')
})
}, []);
const getData = () => {
localStorage.setItem("item", "val chamged");
};
return (
<div className="App">
<h1 onClick={getData}>Change localstorage value</h1>
</div>
);
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能达到这样的效果:当屏幕宽度改变时,字符串"Essem"会改变它们的宽度?
我有HTML:
<h1><span>Essem</span><br />bli.</h1>
Run Code Online (Sandbox Code Playgroud)
github-pages ×2
reactjs ×2
css ×1
deployment ×1
github ×1
html ×1
javascript ×1
node.js ×1
npm ×1
text ×1