My component is a Filter, that receives as a prop some filters, which should be rendered. However props are not rendered:
<Filter key={i}/>
Code is here: https://www.webpackbin.com/bins/-KjI4MiSjlV69O_zaOCD
Filter component:
import React, { PropTypes } from 'react'
import Filter1 from './Filter1'
import Filter2 from './Filter2'
const Filters = ({ filters }) => (
<div>
{ filters.reverse().map((Filter, i) =>
// React.createElement(Filter, { key: i}) does not work
// <p>{Filter}</p> // h
<Filter key={i}/>
)}
<p> This should be seen twice!</p>
<Filter1/>
<Filter2/>
</div>
)
Filters.propTypes = {
filters: PropTypes.arrayOf(PropTypes.string).isRequired
}
export default Filters
One of the filters:
import React from 'react'
function Filter1 () {
return (
<h1>This is filter1</h1>
)
}
export default Filter1