Skip to content

basecss/fileInput

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

fileInput

Image upload and preview, based React.js

example

var React = require('react')
var ReactDOM = require('react-dom')

// import component
var FileInput = require('./src/fileInput')

var App = React.createClass({
  getInitialState: function () {
    return {
      files: []
    }
  },
  onChange: function (files) {
    this.setState({
      files: this.state.files.concat(files)
    })
  },
  render: function () {
    return (
      <div>
        <FileInput onChange={this.onChange} multiple={false} />
        {this.state.files.length ?
        <div className="thumb-box">
          { /* using files */ }
        </div> : null}
      </div>
    )
  }
})

ReactDOM.render(
  <App />,
  document.querySelector(mountNode)
)

About

Image upload and preview, based React.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published