README
React Input Select From LocalStorage
1.Features include:
- Get user's input from keyboard
- Store all user's input in localStorage
- Filter new input from old inputs stored in LocalStorage
- Is selectable
2.Installlation and usage
npm i localstorage_input_select
or
yarn add localstorage_input_select
After install,
copy
assets
folder innode_modules/localstorage_input_select/dist
and paste topublic
folder of project appcopy
index.css
file innode_modules/localstorage_input_select/dist
and importindex.css
to parrent component useInputSelect
Component
Then use it in your app:
Example With React Component
import React from "react";
import InputSelect from "localstorage_input_select/dist/InputSelect";
import "./index.css";
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
inputVal: "",
};
}
handleInputValue = (value) => {
this.setState({ inputVal: value });
};
render() {
return (
<div>
<InputSelect
storeKey="search"
placeholderName="Search"
handleInput={this.handleInputValue}
></InputSelect>
<div>chooseValue: {this.state.inputVal}</div>
</div>
);
}
Props
Common props you may want to specify include:
storeKey
-string
-key to store to localStorageplaceholderName
-string
- name of input's placeholderhandleInput
-function
- handler pass value from InputSelect to parent Component
Thanks
Thank you to everyone who has contributed to this project. It's been a wild ride.
License
MIT Licensed. Copyright (c) Kieu Chi Cong 2020.