Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

with-immutable-props-to-js

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

with-immutable-props-to-js

A higher-order component for keeping Immutable objects outside your presentational components

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
551
decreased by-31.04%
Maintainers
1
Weekly downloads
 
Created
Source

with-immutable-props-to-js

Logo

npm Builds npm downloads codecov Dependabot Status

All Contributors Slack workspace Maturity badge - level 3

A higher-order component for keeping Immutable objects outside your presentational components

Installation

yarn add with-immutable-props-to-js

or

npm install with-immutable-props-to-js

This library also lists react, react-dom, and immutable as peer dependencies, so make sure they are installed in your project as well.

Usage

import withImmutablePropsToJS from 'with-immutable-props-to-js'

If you're not using ECMAScript modules:

const withImmutablePropsToJS = require('with-immutable-props-to-js').default

Example:

import React from 'react'
import { connect } from 'react-redux'
import withImmutablePropsToJS from 'with-immutable-props-to-js'

const MyDumbComponent = props => {
   // ...
   // props.objectProp is turned into a plain JavaScript object
   // props.arrayProp is turn into a plain JavaScript array
}

MyDumbComponent.propTypes = {
   objectProp: PropTypes.object,
   arrayProp: PropTypes.array,
}

const mapStateToProps = state => ({
   objectProp: mySelectorThatReturnsImmutableMap(state),
   arrayProp: mySelectorThatReturnsImmutableList(state),
})

export default connect(mapStateToProps)(withImmutablePropsToJS(MyDumbComponent))

Motivation

You can read about the rationale for this higher-order component here.

Contributors

For information on how to contribute to this project, check out the contributing guide.

Thanks goes to these wonderful people (emoji key):

Michael Rose
Michael Rose

💻 📖 🚇
Brandon Baksh
Brandon Baksh

🚇
greenkeeper[bot]
greenkeeper[bot]

🚇
Jake Bolam
Jake Bolam

📖 🚇
Sanchit Gera
Sanchit Gera

📖
Siavash Mahmoudian
Siavash Mahmoudian

🚇
monicamm95
monicamm95

🎨
Danilo Matamoros
Danilo Matamoros

💻
Roman Mahotskyi
Roman Mahotskyi

🚇
Pablo Morra
Pablo Morra

💻 ⚠️
dependabot[bot]
dependabot[bot]

🚇

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

Special thanks to Carol Skelly for donating the 'tophat' GitHub organization.

Keywords

FAQs

Package last updated on 06 Sep 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc