0
I am trying to use the semantic-ui form.select but am getting Undefined on my payload:
What I tried to:
<Form.Select
fluid
label='Gender'
options={workoutOptions}
placeholder='Atividades'
onChange={this.props.changeTipoTarefa}
value={this.props.tipoTarefa}
/>
I set that constant outside my class:
const workoutOptions = [
{ text: 'Run', value: 'run' },
{ text: 'Swimming', value: 'swimming' },
{ text: 'Bike', value: 'bike' },
]
My brother:
const INITIAL_STATE = { tempoGasto: '', tipoTarefa: '', data: '', list: [] }
export default (state = INITIAL_STATE, action) => {
console.log(action.type)
console.log(action)
switch(action.type) {
case 'TEMPOGASTO_CHANGED':
return { ...state, tempoGasto: action.payload }
case 'TIPOATIVIDADE_CHANGED':
return { ...state, tipoTarefa: action.payload }
case 'DATATAREFA_CHANGED':
return { ...state, changeDataTarefa: action.payload }
case 'WORKOUT_SEARCHED':
return { ...state, list: action.payload }
default:
return state
}
}
I am receiving Undefined as shown on my console.:
TIPOATIVIDADE_CHANGED
payload: Undefined
type: "TIPOATIVIDADE_CHANGED"
How can I get the selected value in select?
export const changeTipoTarefa = event => ({
type: 'TIPOATIVIDADE_CHANGED',
payload: event.target.value
})
I suppose there in payload: Event.target.value is the problem, but I don’t know what to replace.