An open API service indexing awesome lists of open source software.

https://github.com/erykpiast/bs-react-dropzone

ReasonML bindings for react-dropzone library
https://github.com/erykpiast/bs-react-dropzone

bindings drag-and-drop dropzone reason-react reasonml

Last synced: about 1 month ago
JSON representation

ReasonML bindings for react-dropzone library

Awesome Lists containing this project

README

          

# bs-react-dropzone

[![Build Status](https://travis-ci.com/erykpiast/bs-react-dropzone.svg?branch=master)](https://travis-ci.com/erykpiast/bs-react-dropzone)
[![dependencies Status](https://david-dm.org/erykpiast/bs-react-dropzone/status.svg)](https://david-dm.org/erykpiast/bs-react-dropzone)
[![devDependencies Status](https://david-dm.org/erykpiast/bs-react-dropzone/dev-status.svg)](https://david-dm.org/erykpiast/bs-react-dropzone?type=dev)
[![peerDependencies Status](https://david-dm.org/erykpiast/bs-react-dropzone/peer-status.svg)](https://david-dm.org/erykpiast/bs-react-dropzone?type=peer)
[![Greenkeeper badge](https://badges.greenkeeper.io/erykpiast/bs-react-dropzone.svg)](https://greenkeeper.io/)

ReasonML bindings for [react-dropzone](https://github.com/react-dropzone/react-dropzone) library.

## Installation

```
npm i --save bs-react-dropzone react-dropzone
```

Then add `bs-react-dropzone` as a dependency to `bsconfig.json`.

## Usage

```reasonml
[@react.component]
let make = () => {

Js.log(("these files were dropped", acceptedFiles))
}>
{({getInputProps, getRootProps}) => {
let inputProps = getInputProps();
let rootProps = getRootProps();


{"Drop files here" |> React.string}


;
}}
;
};
```

### JSX 2

The package provides fallback for projects using older version of JSX syntax.

```reasonml
let component = ReasonReact.statelessComponent("Demo");

let make = () => {
...component,
render: (_self) => {

Js.log(("these files were dropped", acceptedFiles))
}>
...{({getInputProps, getRootProps}) => {
let inputProps = getInputProps();
let rootProps = getRootProps();


{"Drop files here" |> React.string}


;
}}
;
}
};
```

### Hooks

Hooks are not supported right now. There is [an issue open for that](https://github.com/erykpiast/bs-react-dropzone/issues/3). PRs are welcome!