Hacker News new | past | comments | ask | show | jobs | submit login

Why would it be twice the code? Depending on what it is exactly that you want, you might just add 4 lines of creating a context, passing a value to a provider, checking the value of that context. And in return you get a most readable description of the user interface:

  <Menu isHamburger={isHamburger}>
    <NavLink to="/a">A</NavLink>
    <NavLink to="/b">B</NavLink>
    <DownloadLink file="/c.txt">Download C</NavLink>
    <InfoBox>All services up-and-running</InfoBox>
    <NavLink to="/signOut">Sign out</NavLink>
  </Menu>
Heck, you might not even need a context to accomplish this.

It is not about avoiding iterating through an array either. The objective is the readable description of the user interface. It is to improve orientation and maintainability.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: