小编Sab*_*med的帖子

VSCode 语法错误突出显示不适用于 C++ 代码

Microsoft 的 C/C++ 扩展已安装,一切运行良好。但当出现问题时,VSCode 似乎不会显示任何语法错误的红色下划线。

我正在使用预装了 g++ 的 Linux (kubuntu)。我还可以成功构建我的代码并运行它。

关于如何解决这个问题有什么建议吗?

c++ visual-studio-code

7
推荐指数
1
解决办法
1万
查看次数

使用 TS 使用 React-hook-form 构建应用程序时出错

当我尝试在 TS 中使用 React-hook-form 构建 React 应用程序时,出现以下错误:

node_modules/react-hook-form/dist/types/utils.d.ts:24:77 - error TS1005: '?' expected.

24 declare type PathImpl<K extends string | number, V> = V extends Primitive ? `${K}` : `${K}` | `${K}.${Path<V>}`;
                                                                               ~~~

node_modules/react-hook-form/dist/types/utils.d.ts:24:84 - error TS1005: ';' expected.

24 declare type PathImpl<K extends string | number, V> = V extends Primitive ? `${K}` : `${K}` | `${K}.${Path<V>}`;
                                                                                      ~

node_modules/react-hook-form/dist/types/utils.d.ts:24:110 - error TS1005: '(' expected.

24 declare type PathImpl<K extends string | number, V> = V extends Primitive ? `${K}` …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs react-hook-form

6
推荐指数
1
解决办法
4263
查看次数

在反应组件上使用 CSSTransitionGroup 会出错

错误说“元素类型无效:需要一个字符串(对于内置组件)或一个类/函数(对于复合组件)但得到:未定义。您可能忘记从它定义的文件中导出您的组件。检查的渲染方法Route。”

代码如下所示:

import { CSSTransitionGroup } from 'react-transition-group'
import React, { Component } from 'react';

export default class TodoList extends React.Component {
  constructor(props) {
    super(props);
    this.state = {items: ['hello', 'world', 'click', 'me']};
    this.handleAdd = this.handleAdd.bind(this);
  }

  handleAdd() {
    const newItems = this.state.items.concat([
      prompt('Enter some text')
    ]);
    this.setState({items: newItems});
  }

  handleRemove(i) {
    let newItems = this.state.items.slice();
    newItems.splice(i, 1);
    this.setState({items: newItems});
  }

  render() {
    const items = this.state.items.map((item, i) => (
      <div key={item} onClick={() => this.handleRemove(i)}>
        {item}
      </div>
    ));

    return …
Run Code Online (Sandbox Code Playgroud)

html javascript css reactjs

5
推荐指数
1
解决办法
1万
查看次数