Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 926 Bytes

README.md

File metadata and controls

48 lines (36 loc) · 926 Bytes

fileup-redux

Redux adapter to fileup-core

Installation

  1. Append fileup reducer to application reducers:
import fileup from 'fileup-redux/lib/reducers/fileup';

export default combineReducers({
    fileup,
    //...
});
  1. Decorate you React Component with fileup:
import fileup from 'fileup-redux';

class MyFiles extends React.Component {

    render() {
        return (
            <div>
                {this.props.files.map(file => (
                    <div key={file.uid}>
                        {file.name}
                    </div>
                ))}
                <button onClick={() => this.props.uploader.browse()}>Browse</button>
            </div>
        );
    }

}

export default fileup({
    backendUrl: '/file/upload/',
})(MyFiles);

HOC configuration

  • id Unique identifier in redux store
  • backendUrl Backend url to file upload
  • uploader FileUp configuration