Documents / @faasjs/react / OptionalWrapper
Function: OptionalWrapper()
OptionalWrapper(
props
,deprecatedLegacyContext
?):ReactNode
A wrapper component that conditionally wraps its children with a provided wrapper component.
Parameters
• props: OptionalWrapperProps
<any
>
• deprecatedLegacyContext?: any
Deprecated
See
Returns
ReactNode
Example
import { OptionalWrapper } from '@faasjs/react'
const Wrapper = ({ children }: { children: React.ReactNode }) => (
<div className='wrapper'>{children}</div>
)
const App = () => (
<OptionalWrapper condition={true} Wrapper={Wrapper}>
<span>Test</span>
</OptionalWrapper>
)