Skip to content

Latest commit

 

History

History
36 lines (32 loc) · 568 Bytes

05.children-types.md

File metadata and controls

36 lines (32 loc) · 568 Bytes

Children Types

React can render children of many types. In most cases it’s either an array or a string.

String

function render() {
  return (
    <div>
      Hello World!
    </div>
  )
}

Array

function render() {
  return (
    <div>
      {["Hello ", <span>World</span>, "!"]}
    </div>
  )
}

Functions may be used as children. However, it requires coordination with the parent component to be useful.

function render() {
  return (
    <div>
      { () => "hello world!" }
    </div>
  )
}