小编mor*_*ter的帖子

它必须是一个函数,通常来自React.PropTypes

我想将字符串从Main传递给Header.它成功但警告.我是React的初学者,所以我无法弄清楚是什么it must be a function意思.

谁知道如何解决这个警告?

警告是:

在此输入图像描述

我的代码如下:

Main.js

import React from 'react';

import Header from './Header';
import AppList from './AppList/AppList';
import Footer from './Footer';

const propTypes = {
  mainInfo: React.PropTypes.shape({
    title: React.PropTypes.string.isRequired,
    apps: React.PropTypes.array.isRequired,
  }),
};

class Main extends React.Component {
  static methodsAreOk() {
    return true;
  }

  render() {
    return (
      <div>
        <Header title={this.props.mainInfo.title} />
        <AppList apps={this.props.mainInfo.apps} />
        <Footer />
      </div>
    );
  }
}

Main.propTypes = propTypes;

export default Main;
Run Code Online (Sandbox Code Playgroud)

Header.js

import React from 'react';

const propTypes …
Run Code Online (Sandbox Code Playgroud)

reactjs

52
推荐指数
3
解决办法
3万
查看次数

如何禁用Apache的缓存?

我只将index.html放在/ var/www/html中.更改index.html的内容并重新加载后,页面不会更新.

我已经在httpd.conf中禁用了cache_module,如下所示.

# LoadModule cache_module modules/mod_cache.so
# LoadModule disk_cache_module modules/mod_disk_cache.so
Run Code Online (Sandbox Code Playgroud)

apache

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

如何检查目录是否为chef中的符号链接

如果它不是symlnik,我只想删除目录.

directory "/var/www/html/" do
  action :delete
  only_if ???
end
Run Code Online (Sandbox Code Playgroud)

shell chef-infra

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

我想在 TypeScript-ed React 中使用 superagent

我想在 TypeScript-ed React 中使用 superagent。我尝试使用 TypeScript编写教程并尝试在请求服务器时使用超级代理。虽然我可以使用marked.

当我尝试使用标记的超级代理时,找不到请求。

在此处输入图片说明

当我尝试导入 superagent 时,找不到同一文件夹中的其他文件。

在此处输入图片说明

嗯……

我的 tsd.d.ts 是

/// <reference path="react/react.d.ts" />
/// <reference path="react/react-dom.d.ts" />
/// <reference path="node/node.d.ts" />
/// <reference path="superagent/superagent.d.ts" />
/// <reference path="marked/marked.d.ts" />
Run Code Online (Sandbox Code Playgroud)

package.json 是

{
  "name": "react-my-first",
  "version": "1.0.0",
  "scripts": {
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "lite": "lite-server",
    "start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
  },
  "license": "ISC",
  "dependencies": {
    "react": "^0.14.6",
    "react-dom": "^0.14.6"
  },
  "devDependencies": {
    "concurrently": "^1.0.0",
    "lite-server": "^1.3.1",
    "typescript": …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs

0
推荐指数
1
解决办法
5479
查看次数

标签 统计

reactjs ×2

apache ×1

chef-infra ×1

shell ×1

typescript ×1