Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@moltin/react-shopkit
Advanced tools
[![CircleCI](https://circleci.com/gh/moltin/shopkit.svg?style=svg)](https://circleci.com/gh/moltin/shopkit) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release
Install the package from npm inside your React project.
yarn add @moltin/react-shopkit
Next, inside your application, you need to wrap your root component with the <ShopkitProvider />
and set your clientId
. You can also set a custom color
.
import { Shopkit as ShopkitProvider } from '@moltin/react-shopkit'
ReactDOM.render(
<ShopkitProvider clientId='INSERT_CLIENT_ID'>
<App />
</ShopkitProvider>,
document.querySelector('#root')
)
The components below can be imported and configured for use inside your application.
The quickest way to add Moltin to your website is to use the <BuyButton />
component. Simply specify a Product ID and instantly have it added to the cart functionality.
Prop | Default | Required | Description |
---|---|---|---|
id | undefined | Yes | Your Moltin product ID |
cartId | undefined | No | A custom Cart ID (otherwise, created automatically) |
children | undefined | Yes | A custom render function for your button |
import React from 'react'
import { BuyButton } from '@moltin/react-shopkit'
export default () => (
<BuyButton id="61abf56a-194e-4e13-a717-92d2f0c9d4df">
{({ addToCart }) => <button onClick={addToCart}>Add to Cart</button>}
</BuyButton>
)
Shopkit abstracts the cart functionality to the <ShopkitProvider />
component that wraps your entire application. Using the React Context API internally we are able to manage all cart state in one place and make it available to all other components.
import React from 'react'
import { CartButton } from '@moltin/react-shopkit'
export default () => (
<CartButton>
{({
total,
count,
shown,
onClick,
items,
updateCartQuantity,
removeFromCart
}) => (
<ul>
{items.map(item => (
<li key={item.id}>{item.name}</li>
))}
</ul>
)}
</CartButton>
)
FAQs
[![CircleCI](https://circleci.com/gh/moltin/shopkit.svg?style=svg)](https://circleci.com/gh/moltin/shopkit) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release
The npm package @moltin/react-shopkit receives a total of 1 weekly downloads. As such, @moltin/react-shopkit popularity was classified as not popular.
We found that @moltin/react-shopkit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.