import React, { Component } from 'react' import { rules, findRuleByName } from 'Engine/rules' import { reject, curry } from 'ramda' import { Link } from 'react-router-dom' import './TargetSelection.css' export let salaries = [ 'salaire net', 'salaire de base', 'salaire total' ] export default class TargetSelection extends Component { state = { targets: [] } render() { let { targets } = this.state return (

Que voulez-vous calculer ?

{this.renderOutputList()} {targets.length !== 0 && (

Vous pouvez faire plusieurs choix

)}
) } renderOutputList() { let popularTargets = [...salaries, 'aides employeur différées'].map(curry(findRuleByName)(rules)), { targets } = this.state return (
{popularTargets.map(s => ( this.setState({ targets: targets.find(t => t === s.name) ? reject(t => t === s.name, targets) : [...targets, s.name] }) } /> ))}
) } }