Filtering by Multiple Attributes

@users = User.allrender json: @users, except: [:username, :password_digest, :created_at, :updated_at],include: [:days]
state = {curl_pattern: "2a",curl_type: "wavy",porosity: "low",density: "thin",width: "thin"}
<h3>Filter by Hair Type</h3><form> <label>Curl Pattern</label><select name="curl_pattern" id='curlPattern'value={this.state.curl_pattern} onChange={this.handleFormChange}><option value="2a">2A</option><option value="2b">2B</option><option value="2c">2C</option><option value="3a">3A</option><option value="3b">3B</option><option value="3c">3C</option><option value="4a">4A</option><option value="4b">4B</option><option value="4c">4C</option> </select>
handleFormChange = event => {this.setState({[event.target.name]: event.target.value});}
curlPatternFilter() {if(this.props.users[9]){ return(this.props.users.filter(user => user.curl_pattern === this.state.curl_pattern && user.curl_type === this.state.curl_type && user.porosity === this.state.porosity && user.density === this.state.density && user.width === this.state.width))}}

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Use Google Distance Matrix API on front-end or back-end with React

Asics Gel Kayano 22 https://t.co/3pDDJFSMM2 https://t.co/86nOUmIOIO

React.js: What’s so good about the front end technology of Facebook?

ES6/ES7 features explained in a straightforward way

Server side code highlighting in Node

After accepting users’ suggestions on the amendment, we redeployed the contract. #BinanceSmartChain

Hacking with Handlebars in Java and Clojure: Part I

Publish Your Own NPM Module

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Zachary Williams

Zachary Williams

More from Medium

Restrictions on crypto advertising: what we can learn from the past

AT THE SPEED OF LIFE

Gradle dependency management

Time is constant —it only changes.