Created
August 2, 2018 17:17
-
-
Save knod/e6fc7e30678f183bc3cee56775ebd2d2 to your computer and use it in GitHub Desktop.
A safe way to do `<RenderIfTrue>`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is something we could possibly do more safely | |
const RenderIfTrue = function ({ shouldRender, children }) { | |
var ToRender = children; | |
if (shouldRender) { | |
return <ToRender />; | |
} else { | |
return null; | |
} | |
}; // End <RenderIfTrue> | |
<RenderIfTrue shouldRender = { current.mortgage > 0 }> | |
{() => { return ( | |
<CashFlowDisplayRow | |
timeState = { current } | |
generic = { `mortgage` }>Test | |
</CashFlowDisplayRow> | |
);}} | |
</RenderIfTrue> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A safe possibility that would work with our eslint configuration.