JXS In Depth

1、Spread Attributes

  If you already have props as an object, and you want to pass it in JSX, you can use ... as a "spread" operator to pass the whole props object. These two components are equivalent:

  

2、Functions as Children

  props.children可以是一个函数。只要render()最终返回的是jsx就行了。

  Normally, JavaScript expressions inserted in JSX will evaluate to a string, a React element, or a list of those things. However, props.children works just like any other prop in that it can pass any sort of data, not just the sorts that React knows how to render. For example, if you have a custom component, you could have it take a callback as props.children:

   
  Children passed to a custom component can be anything, as long as that component transforms them into something React can understand before rendering. This usage is not common, but it works if you want to stretch what JSX is capable of.
3、jsx中使用条件expression
  

参考:https://facebook.github.io/react/docs/jsx-in-depth.html#user-defined-components-must-be-capitalized

JXS In Depth的更多相关文章

  1. [LeetCode] Minimum Depth of Binary Tree 二叉树的最小深度

    Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shor ...

  2. [LeetCode] Maximum Depth of Binary Tree 二叉树的最大深度

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...

  3. leetcode 111 minimum depth of binary tree

    problem description: Given a binary tree, find its minimum depth. The minimum depth is the number of ...

  4. 【leetcode】Minimum Depth of Binary Tree

    题目简述: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along th ...

  5. LeetCode 104. Maximum Depth of Binary Tree

    Problem: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along ...

  6. OpenCV2:Mat属性type,depth,step

    在OpenCV2中Mat类无疑使占据着核心地位的,前段时间初学OpenCV2时对Mat类有了个初步的了解,见OpenCV2:Mat初学.这几天试着用OpenCV2实现了图像缩小的两种算法:基于等间隔采 ...

  7. [Unity3D]深度相机 Depth Camera

    作为3D世界里最重要的窗口,摄像机的应用就显得很重要,毕竟在屏幕上看到的一切都得用摄像机矩阵变换得来的嘛.论坛上看到了一篇帖子讲非天空盒的背景做法,让我想起其实很多界面合成画面可以用摄像机之间的交互来 ...

  8. G-FAQ – Why is Bit Depth Important?

    直接抄: https://apollomapping.com/2012/August/article15.html For this month’s Geospatial Frequently Ask ...

  9. [LintCode] Maximum Depth of Binary Tree 二叉树的最大深度

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...

随机推荐

  1. Jquery,全选,反选,

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  2. centos安装dlib

    小心这个错误 c++: 编译器内部错误:已杀死(程序 cc1plus)     # 内存不足,可解决的 复制如下命令: yum install cmake python-devel numpy gcc ...

  3. python-开放类优化内存性能

    开放类:在运行期间,可动态向实例或类添加新成员,方法 1.实例不能添加方法到类,反之可以 class A: pass a = A() a.func = lambda x: x+1 a.func # & ...

  4. iOS 第三方应用调用safari

    一,直接调用safari打开url [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www. ...

  5. centos出现“FirewallD is not running”

    最近在服务器centos上安装了rdis数据库,默认是不开启远端访问功能,需要设置一下防火墙,在开放默认端口号 8888时提示FirewallD is not running,经过排查发现是防火墙就没 ...

  6. py库: jieba (中文词频统计) 、collections (字频统计)、WordCloud (词云)

    先来个最简单的: # 查找列表中出现次数最多的值 ls = [1, 2, 3, 4, 5, 6, 1, 2, 1, 2, 1, 1] ls = ["呵呵", "呵呵&qu ...

  7. linux path 与 classpath 区别

    一.OS依据path中的路径信息来寻找可执行指令: 例如: cat /etc/profile 我们就可以在任意目录执行hadoop / hdfs / yarn / java 等相关命令了 export ...

  8. 静态属性@property

    property 作用其实把类里面的逻辑给隐藏起来(封装逻辑,让用户调用的时候感知不到你的逻辑) property实例1:class Room: def __init__(self): pass @p ...

  9. RabbitMq (1)

    1.传递模型 点对点模型(PTP) 发布-订阅模型 -------------------------------------------------------------------------- ...

  10. 解决 shopnc b2b2c 版权问题 修改路经ULR及目录文件夹思路及教程

    相信各位使用过NC的朋友,多多少少收到过律师函,把一堆人吓尿了,原因你使用了盗版,大哥都要吃饭可以理解#网络那么大,他怎么能快速定位到您的,原因很简单 搜索引擎,NC在开发中定义了URL路由规则,在百 ...