Last active
          December 28, 2020 00:19 
        
      - 
      
- 
        Save KoenBrouwer/2f739c4a67bfcc7e1424a50a262c101f to your computer and use it in GitHub Desktop. 
Revisions
- 
        KoenBrouwer revised this gist Dec 28, 2020 . No changes.There are no files selected for viewing
- 
        KoenBrouwer created this gist Dec 28, 2020 .There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ import React from "react"; interface ConditionalWrapProps { condition: boolean; wrap: (children: JSX.Element) => JSX.Element; children: JSX.Element; } const ConditionalWrap: React.FC<ConditionalWrapProps> = ({condition, children, wrap}): JSX.Element => condition ? React.cloneElement(wrap(children)) : children; export default ConditionalWrap;