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. android 开发 碎片Fragment布局例子(用按键切换碎片布局)

    实现思路: 1.写一个父类布局,里面写一个按键和一个帧布局(用于给Fragment布局后续替代) 2.写3个子布局,并且在写3个class继承Fragment布局 3.在MainActivity的cl ...

  2. fabric-ca1.03安装

    前面的文档已经成功的安装了fabric1.0.1的e2e例子.之后代码换成1.0.3版本按步骤重新安装一下,就可以切换到1.0.3了.1.0.3的脚本和启动命令没有变化,还是用的1.0.1的. 1.准 ...

  3. 【SQL函数】我知道你想group_concat和count一起用,比如不同组合的人数?

    0.背景 前几天复习了一下MySQL函数,知道一个group_concat函数很好用,但一直没实际用过.今天碰到一个问题,把我问懵逼了. 1.实例 假设有一张用户购买产品的增量表order_list, ...

  4. linux socket使用情况 ss -s ss -t -a | cat /proc/net/socketstat

    Linux系统中,查看SOCKET使用情况可以使用ss命令. 1.命令格式:ss [参数]ss [参数] [过滤]2.命令功能:ss(Socket Statistics的缩写)命令可以用来获取 soc ...

  5. ssh 第一次登录输入yes 问题

    #!/bin/bash for i in hadoop01 hadoop02 hadoop03 hadoop04 hadoop05 hadoop06 hadoop07 hadoop08 hadoop0 ...

  6. 利用java反射排查一次线上问题(确定问题及问题定位)

    背景 hive 用的 1.1.0版本(其实这个版本bug挺多,包括执行计划串列的等等问题吧,建议大家如果选1.x版本用1.2.2吧),一下提到的代码部分如无特殊说明都是hive-1.1.0版本. 前段 ...

  7. java poi处理excel多sheet并实现排序

    需求:有一个数据字典全量汇总表,其中第一个sheet为目录,包括编号和表名,第二个以后为表的明细.其中sheet名就是表名但无序,sheet内字段序号无序有空行 现在要求将其中101,104,107, ...

  8. react-native 安卓支持 gif动态图

    需要在android/app/build.gradle文件中添加模块 //这一行没有的话得加上才行 compile "com.facebook.fresco:fresco:1.5.0&quo ...

  9. Srping cloud Ribbon 自定义负载均衡

    IRule 默认提供有7种方式,使用轮询方式 如何自定义 1:主启动类加@RibbonClient @RibbonClient(name="微服务名", configuration ...

  10. 本地项目 共享 到github仓库

    一.安装git客户端 Window下安装Git客户端. 二.配置Intellij idea中的Git/ GitHub 选择Github,填写Host.Login和Password,然后Test是否成功 ...