ReactJs How to use react-select with redux-form? reactjs react native,reactjs react native share code,reactjs react

I am trying to integrate react-select using redux form...

Here is my code

import Select from 'react-select'
import StyledSelectField, { StyledMessages } from './style'

const SelectField = props => {
  const { input, label, placeholder, options, meta, ...StyledProps } = props
  const { onChange, onBlur, onFocus } = props.input
  return (
    <StyledSelectField {...StyledProps} meta={meta} hasValue={!!input.value}>
      <label htmlFor={input.name}>{label}</label>
      {placeholder && <div className="placeholder">{placeholder}</div>}
      <Select
        name={input.name}
        value={input.value.value}
        onChange={onChange}
        onBlur={onBlur}
        onFocus={onFocus}
        options={options}
        {...props}
      />
      <StyledMessages>
        {meta.touched &&
          ((meta.error && <span className="error">{meta.error}</span>) ||
            (meta.warning && <span className="warning">{meta.warning}</span>))}
      </StyledMessages>
    </StyledSelectField>
  )
}

class TestingCycleForm extends PureComponent {
  render() {
    const { preMonitoring, handleChange, handleSubmit } = this.props
    return (<div>
      <Field
        label="18%"
        name="patientPercentage"
        className="form-control"
        component={SelectField}
        options={Config.get('/PATIENT_PERCENTAGE')}
      />
    </div>)
  }
}

All things are working but my input field gets cleared on focus out what I am doing wrong here?

Thanks in advance... Any help would be appreciated

Answer:1



  1. reactjs react native
  2. reactjs react native share code
  3. reactjs react router
  4. reactjs react table
  5. reactjs react hooks
  6. reactjs react router dom
  7. reactjs react fragment
  8. reactjs react-router-dom example

I am learning react and redux and trying to implement login .. below is my routing import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; import Login from './...

I am learning react and redux and trying to implement login .. below is my routing import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; import Login from './...

I'm trying to import a javascript class with default export. But I cannot use the functions defined in it. An error says "Uncaught TypeError: _omise2.default.setPublicKey is not a function" Here is ...

I'm trying to import a javascript class with default export. But I cannot use the functions defined in it. An error says "Uncaught TypeError: _omise2.default.setPublicKey is not a function" Here is ...