your recipe card header background

    hocComponent

    0

    2

    lucycodes42

    JavaScript snippets for React

    The code above creates a function that takes an object as a parameter. It then creates a WrappedComponent object that contains the properties of the object. Finally, the code adds a property to the WrappedComponent object that contains the propTypes for the object.

    Library: react

    Shortcut: hoc

    import React from 'react'
    import PropTypes from 'prop-types'
    
    export default (WrappedComponent) => {
      const hocComponent = ({ ...props }) => <WrappedComponent {...props} />
    
      hocComponent.propTypes = {}
    
      return hocComponent
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.