Display UI elements in different order

Use a prop to specify order – Map through ReactElements and render it based on order prop.

  1. class PageSections extends Component {
  2. render() {
  3. const pageItems = this.props.contentOrder.map(
  4. (content) => {
  5. const renderFunc = this.contentOrderMap[content];
  6. return (typeof renderFunc === 'function') ? renderFunc() : null;
  7. }
  8. );
  9. return (
  10. <div className="page-content">
  11. {pageItems}
  12. </div>
  13. )
  14. }
  15. }