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 开发 xml绘制shape与Selector与layer-list 一 基础篇

    首先我们先来了解状态效果 android:state_pressed=["true" | "false"]  按下状态 android:state_focuse ...

  2. 用网线直连的两台PC上的虚拟机通过网线通信的配置

    Configure the ROS Networks: Quick Reference: http://blog.csdn.net/sonictl/article/details/46986565#t ...

  3. 9.Appium使用安装所需软件百度盘链接

    Appium使用安装所需软件大全: 1.抓包工具 Charles : 链接:https://pan.baidu.com/s/1KomTDV2_o1dEDvlimrd5HQ 提取码:5yn2 2.抓包工 ...

  4. python中的clear

    1 a = { 2 "name":"dlrb", 3 "age":25, 4 "height":168 5 } 6 a. ...

  5. ant 标签详解

    Ant 开发 Ant的构建文件当开始一个新的项目时,首先应该编写Ant构建文件.构建文件定义了构建过程,并被团队开发中每个人使用.Ant构建文件默认命名为build.xml,也可以取其他的名字.只不过 ...

  6. RPC框架之RMI

     一:RPC 远程过程调用 RPC(Remote Procedure Call Protocol)远程过程调用协议,通过网络从远程计算机上请求调用某种服务. 一次RPC调用的过程大概有10步: 1.执 ...

  7. Ubuntu系统tensorflow安装问题及解决

    su root   ps:如果你没有改过root密码,sudo passwd 然后输入你的账户密码,然后设置你的root密码 在root权限下执行pip install --upgrade pip 更 ...

  8. java 构造json对象数组

    利用for构造 import com.google.gson.JsonArray; import com.google.gson.JsonObject; public class Test { pub ...

  9. WPF 中 TextBlock 文本换行与行间距

    换行符: C#代码中:\r\n 或  \r 或 \n XAML中: 或 注:\r 回车 (carriage return 缩写),\n 新行 (new line 缩写). 行间距: LineHeigh ...

  10. 03-body标签中相关标签-2

    主要内容: 列表标签 <ul>.<ol>.<dl>表格标签 <table>表单标签 <form> 一.列表标签 列表标签分为三种. 无序列表 ...