npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-dnd-components

v0.0.2

Published

Wrapper components for react-dnd

Readme

react-dnd-components

Simple react Component wrappers around react-dnd target, source and context components.

For better understanding the following terminology consult the react-dnd docs

For examples see examples folder.

Context

This Component is a wrapper around react-dnd context, all other react-dnd components should reside inside a Context components.

Props

  • backend -
  • style - propagate the style to the wrapper.
  • className - propagate the className to the wrapper.

Usage

import { Context } from 'react-dnd-components'

...
  <Context backend="touch" style={{color: 'red'}} className="react-dnd-context">
    ... 
  <Context>
...

Target

This Component is a wrapper around react-dnd target, it should reside inside a Context component.

Props

  • style - propagate the style to the wrapper.
  • className - propagate the className to the wrapper.
  • types - Required. The types supported components, it will only react to those.
  • specs - Required. plain object implementing the react-dnd drop target specification.

Usage

import { Target } from 'react-dnd-components'

...
  <Target 
    style={{color: 'red'}}
    className="react-dnd-context"
    types={['card-type-a', 'card-type-b']}
    specs={{
      // Optional. Called when a compatible item is dropped on the target
      drop: (props, monitor, component) => ({id: props.dndId}),
      // Optional. Called when an item is hovered over the component.
      hover: (props, monitor, component) => changeStyleToHover(),
      // Optional. Use it to specify whether the drop target is able to accept the item.
      canDrop: (props, monitor) => true,
    }}>
    ... 
  <Target>
...

Source

This Component is a wrapper around react-dnd target, it should reside inside a Context component.

Props

  • style - propagate the style to the wrapper.
  • className - propagate the className to the wrapper.
  • type - Required. The the component type.
  • specs - Required. plain object implementing the react-dnd drop source spec specification.

Usage

import { Source } from 'react-dnd-components'

...
  <Source 
    style={{color: 'red'}}
    className="react-dnd-context"
    types={'card-type-a'}
    specs={{
      // Required. When the dragging starts, beginDrag is called. 
      // You must return a plain JavaScript object describing the data being dragged.
      beginDrag: (props, monitor, component) => ({id: props.dndId}),
      // Optional. When the dragging stops, endDrag is called. 
      // For every beginDrag call, a corresponding endDrag call is guaranteed. 
      endDrag: (props, monitor, component) => fireAction(),
      // Optional. Use it to specify whether the dragging is currently allowed.
      canDrag: (props, monitor) => true,
      // Optional. By default, only the drag source that initiated 
      // the drag operation is considered to be dragging. 
      isDragging: (props, monitor) => props.canDropFlag,
    }}>
    ... 
  <Source>
...