npm.io
1.0.5 • Published 6 years ago

react-profile-image-box

Licence
MIT
Version
1.0.5
Deps
0
Size
21 kB
Vulns
0
Weekly
0

react-profile-image-box

Profile image box for user to view profile image and upload image to server

NPM JavaScript Style Guide

Image Box

Install

npm install --save react-profile-image-box

Usage

import React, { Component } from 'react'

import ProfileImageBox from 'react-profile-image-box'

export default class App extends Component {
  state = {
    src: "http://test.com/avatar_images_by_user/72"
  }

  onFileChange(e, additionalParams) {
    console.log(e.target.files);    
    console.log(additionalParams);
    
    this.setState({src: "http://test.com/avatar_images_by_user/70"});
  }

  render () {
    return (
      <div>
        <ProfileImageBox 
          alt="Alt Text" 
          allowUpload={true} 
          onFileChange={(e) => this.onFileChange(e, {type: 'user-image'})} 
          src={this.state.src}/>
      </div>
    )
  }
}

License

MIT pritomkucse