1.0.1-rc • Published 2 years ago

fornari-react-templates v1.0.1-rc

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

State Initializer + Function Child

State initializer + Function Child pattern implementation.

Example

import {ProductCard,ProductImage,ProductTitle,ProductButtons} from 'fornari-react-templates'
<ProductCard 
    product={product} 
    initialValues={{
    count: 5,
    maxCount: 10
    }}
>
    {
        ({
            count,
            product,
            maxCount,
            isMaxCountReached,
            increaseBy,
            reset
        }) => {
            /* 
            -> here you can write some magic <-
            */
            return (
                <>
                    <ProductImage />
                    <ProductTitle title='Custom title' />
                    <ProductButtons />
                </>
            )
        }
    }
</ProductCard>

Carlos Fornari