React 条件渲染 if
2017-11-17 21:04
429 查看
{false}
<html> <head> <title>Document</title> <script src="../react.js"></script> <script src="../react-dom.js"></script> <script src="http://cdn.bootcss.com/babel-core/5.8.38/browser.min.js"></script> </head> <body> <div id="reactContainer"/> <script type="text/babel"> function UserGreeting(props) { return <h1>welcome back</h1> } function GuestGreeting(props) { return <h1>please sign up</h1> } function Guest(props) { const isLoggedIn = props.isLoggedIn if (isLoggedIn) { return <UserGreeting /> } return <GuestGreeting /> } ReactDOM.render( <Guest isLoggedIn={false}/>, document.getElementById('reactContainer') ) </script> </body> </html>
相关文章推荐
- React-(if)条件渲染-condition
- React(8)条件渲染(类似 Vue 的 v-if)
- 在 React 条件渲染中使用三元表达式和 “&&”
- 【条件渲染】关于在<template>上使用v-if分类的理解
- React中使用if else 条件判断
- 详解React 的几种条件渲染以及选择
- React中使用if else 条件判断
- React——条件渲染
- React中使用if else 条件判断
- vue简单的if条件渲染和for循环
- React中使用if else 条件判断
- Vue.js 条件渲染 v-if、v-show、v-else
- react-bits:条件渲染
- v-if,v-show条件渲染
- React中使用if else 条件判断
- React学习笔记之条件渲染(一)
- Vue------第三天(条件渲染:v-if、v-show;列表渲染:v-for)
- React中使用if else 条件判断
- 在 React 条件渲染中使用三元表达式和 “&&”
- 微信小程序之wx:if视图层的条件渲染 —— 微信小程序教程系列(10)