我学习了 Git 和使用 VSCode,只学习了提交“amend”命令,现在在 origin (GitHub) 上尝试它。
我找不到任何方法来做到这一点。我是否需要一些外部工具才能做到这一点?我在 VSCode 的 Git 菜单中没有看到任何“push amend”
我突然收到这个错误,不知道为什么。我没有更改版本"react-router-dom": "^6.0.0-beta.4"
。但是"react-dom": "^16.8.4"
“已更改为"react-dom": "^16.13.1"
,不知道这是否与我不知道有什么关系,但它useRoutes
来自哪里"react-router-dom"
,这就是错误的根源。
有人知道吗?
这是我使用的 App.jsx useRoutes(routes)
,它给了我错误:
import React, { useEffect } from 'react';
import { AnimatePresence } from 'framer-motion';
import { connect } from 'react-redux';
import { compose } from 'recompose';
import { useRoutes } from 'react-router-dom';
import { ThemeContextProvider } from './theme/ThemeProvider';
import { getAlbumData } from './redux/albumData/albumData.actions';
import { getMetaData } from './redux/albumMetaData/albumMetaData.actions';
import {
startTagsListener,
startTagsCategoryListener,
} from './redux/global/global.actions';1111
import { withAuthentication } from …
Run Code Online (Sandbox Code Playgroud) 我学习 React JavaScript,现在遇到这个问题
我在 GitHub 中分叉了notistack 库,然后使用 Git Desktop 下载我的分叉,因此该项目位于 Windows 10 上的 D:/git/notistack。
在遵循npm-link 文档之后,一切正常,我可以在 VScode 中调试运行notistack 库打字稿项目。
我的 notistack 库上的“npm link”和 ReactJs 项目中的“npm link notistack”都是标准程序,我可以调试运行该库。我进行了更改并重建了notistack 库,我发现它工作正常。
但是,当我像这样设置 launch.json 并使用runtimeArgs来启用调试时,我无法使断点在库中工作。
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Edge",
"request": "launch",
"type": "pwa-msedge",
"url": "https://localhost:6545",
"webRoot": "${workspaceFolder}",
"runtimeArgs": [
"--preserve-symlinks"
],
}
]
}
Run Code Online (Sandbox Code Playgroud)
我在 ReactJs 项目 node_module/notistack 库中设置了断点,但 VSCode 将它们设置为未绑定断点。
我怀疑这与 notistack 库可能是一个 Typescript 项目有关,并且我链接到了一个 ReactJs 项目。任何想法?请建议我需要检查和做什么?
我使用 VSCode 学习 Reactjs,但我找不到任何关于此的信息,但我希望拥有component
在发布构建期间不会运行的代码。
我有这个组件:
import React from 'react';
import { connect } from 'react-redux';
import { Navbar, Nav, Form, FormControl, Button, Container, Col } from 'react-bootstrap';
import '../../styles/navbar.scss';
class NavBar extends React.Component {
constructor() {
super();
this.state = { showMenu: false, height: 0, width: 0 };
this.handleMenuClick = this.handleMenuClick.bind(this);
this.window = React.createRef();
window.addEventListener('resize', this.update);
}
componentDidMount() {
this.update();
}
update = () => {
this.setState({
height: window.innerHeight,
width: window.innerWidth,
});
};
handleMenuClick() {
const { showMenu } …
Run Code Online (Sandbox Code Playgroud) 我学习yalc并完全按照它所说的去做,但是当我更改我所做的库代码时yalc publish
,我在我的应用程序中看不到代码更改。
该库不是stack
脚步:
yalc add notistack
或yalc link notistack
然后,当我更改 notistack 代码并运行yalc push
时,什么也没有发生,但文档说我应该在我的应用程序中更改代码?
我什至重新启动应用程序服务器并执行此操作,yalc update notistack
但通知堆栈代码更改不可见。
奇怪的是在我的应用程序 VSCode node_modules 中我看到notistack
代码发生了变化。这就像将yalc push
通知堆栈更改传播到应用程序,但应用程序没有使用它们。
更奇怪的是,当我重新启动 VSCode 并启动 App Server 进行调试时,仍然使用旧的 notistack 代码。
我尝试删除yalc remove notistack
并重新启动笔记本电脑,然后再次执行此操作yalc add notistack
。然后我再次看到旧代码。
我尝试在 Chrome 浏览器中对空现金进行硬重置,但没有成功。
当我去 yalc 商店查看时:C:\Users\user\AppData\Local\Yalc\packages\notistack\1.0.10\src:
我看到了最新的代码。
在 Chrome 检查器控制台中,我看到旧代码,但在检查器源下,存在正确的代码。这太令人困惑了。我也无法设置断点,不能在 Inspector 或 VSCode 中设置断点,不能在 notistack 中设置断点。就像 JavaScript 文件错位一样。
Edge 和 Chrome 中都会发生这种情况。 …
我阅读了使用 JavaScript 进行身份验证,但我看不到错误代码的解决方案auth/credential-already-in-use
。
基本上我尝试 linkWithPopup 但用户之前已经在另一个浏览器中登录,所以我无法链接他,所以我可以简单地在这个浏览器中登录他,不需要链接。
这就是我收到此错误的原因auth/credential-already-in-use
我有这个代码:(
这firebase.auth.currentUser
是一个匿名登录用户)
onSocialLoginLink = provider => {
const { firebase, changeUserRole } = this.props;
firebase.auth.currentUser
.linkWithPopup(firebase[provider])
.then(res => {
if (res.credential) {
// do stuff;
}
})
.catch(error => {
if (error.code == 'auth/credential-already-in-use') {
// Here I want to directly sign in with this credential
console.log('linkWithProvider Failure, error', error);
console.log('linkWithProvider Failure, error["credential"]', error['credential']);
} else {
this.setState({ error });
}
});
};
Run Code Online (Sandbox Code Playgroud)
我是这方面的初学者,我在文档中找不到如何做到这一点。在执行此操作之前我是否必须先注销匿名用户signInWithPopup
?是否可以在没有用户交互的情况下做到这一点 …
我学习了 React JavaScript,现在我有一个关于 React Redux 的问题。
我有一个组件可以监听一个被磨损的 Redux 存储值 newTag
这是组件:
/*
* Component handles creating new Tags
*/
class AddTag extends React.Component {
constructor(props) {
super(props);
this.state = {
tagName: '',
categoryName: '',
};
}
submit = () => {
const { tagName, categoryName } = this.state;
const { tagsTag, tagsCategories } = this.props;
// Test if the tag is already created
const result = tagsTag.find(tag => tag.name === tagName);
if (result) {
if (result.category.name === categoryName.name) console.log('jj');
} …
Run Code Online (Sandbox Code Playgroud) 为什么我必须手动将每个文件的“CRLF”更改为“LF”才能使 eslint(prettier) 警告消失?
当提交并且其他用户在各自的环境中加载文件时,这种方法会出现问题吗?正如你在图片中看到的那样,我收到了 "eslint": "^6.6.0"
投诉,当我将右下方的“CRLF”切换为“LF”时,eslint(更漂亮)很高兴。
这以后会成为问题吗?
我学习了 JavaScript 和 React Redux 并有这个问题:。
假设我有这个 Redux dispatch
:
dispatch(setLogMessage( () =>{"Connecting to env1", 12340, "connecting"}));
Run Code Online (Sandbox Code Playgroud)
减速器在这里是为了上面setLogMessage
的:
const initialState = {
log: "",
};
case booksActionTypes.LOG_MESSAGE: {
return {
...state,
log: action.payload,
};
}
Run Code Online (Sandbox Code Playgroud)
在mapStateToProps
它看起来像这样:
const [theLog, addLog] = useState([]);
useEffect(() => {
if (props.log !== "") {
addLog([...theLog, createData(props.log)]);
}
}, [props.log]);
function createData(message, timestamp, type) {
console.log('s');
return { message, timestamp, type };
}
Run Code Online (Sandbox Code Playgroud)
问题是我玩弄并想在这种情况下学习箭头函数,并希望拥有上述props.log
功能,成为解决上述问题() =>{"Connecting to env1", 12340, "connecting"}) …