reactjs


Default value in react-ranger with redux form


i'm using react-slider which i made compatible with redux form and i want it to have default Values which i pass.
My component looks like this:
export default field => (
<div>
<Range
onChange={field.input.onChange}
value1={field.input.value1 ? field.input.value1 : field.min}
value2={field.input.value2 ? field.input.value1 : field.max}
// min={0}
// max={162}
defaultValue={[field.min, field.max]}
>
{field.children}
</Range>
{field.meta.touched && field.meta.error &&
<span className="error">{field.meta.error}</span>}
</div>
);
and i render it here:
<Field
id="value-slider"
name="value-slider"
component={MyRange}
min={minPrice}
max={maxPrice}
/>
But it does not seem to work. Any ideas what i'm missing?
I found a solution:
I've edited my Range component like this:
export default field => (
<div>
<Range
{...field}
onChange={field.input.onChange}
value1={field.input.value1}
value2={field.input.value2}
// min={0}
// max={162}
// defaultValue={[0, 162]}
>
{field.children}
</Range>
{field.meta.touched && field.meta.error &&
<span className="error">{field.meta.error}</span>}
</div>
);
and then i've add
min={minPrice}
max={maxPrice}
defaultValue={[minPrice, maxPrice]}

Related Links

Have child of react component know the height of other child within the component
React Redux - Is there a way to wait until redux dispatch actions are finished via a promise?
Redux, store same value more than once
ImmutableJS Map, how to iterate over a map and return a modified result
How to get filtered object length
Updating Redux with Sqlite3 in an Electron application
Redux - how to call an action creator from inside another action creator?
Fetch API cannot load, cors
Reactjs datatable with tree grid support
Eroor:F:/ReactNativeProject/FirstProject/index.android.js: Unexpected token, expected ( (23:8)
Payload in React & React Native
Invalid prop `component` supplied to `Route` in Route. Issue with props?
Using async setState
In JavaScript, cannot document.getElementById is null even if the element is in the DOM
How to assign the correct typing to React.cloneElement when giving properties to children?
Webpack & Typescript image import

Categories

HOME
optimization
primefaces
sql-server-2014
sip
service
aix
latex
mifare
magento-1.9.2.1
stdout
coordinates
symfony-3.2
wavefront
wkhtmltopdf
decoding
http-status-codes
minimum
responsive
appsettings
greensock
web-parts
beaker-notebook
apdu
deployment-descriptor
formtastic
cloudformation
drombler-fx
windows-10-mobile
angular-schema-form
custom-fields
spring-data-gemfire
delphi-2010
arp
overflow
ios-autolayout
oracle-nosql
webclient
n1ql
machine-code
cache-control
aweber
respect-validation
hippocms
libconfig
taleo
synchronized
qtwebkit
mef
pyopenssl
noise
jscoverage
wink
wicketstuff
ios-keyboard-extension
suitesparse
computed-properties
consolidation
particle-system
kik
user-profile
phpdesigner
paypal-subscriptions
alchemy
web-performance
magnet-uri
random-sample
transport
personality-insights
first-order-logic
eaaccessory
vspackage
ultraedit
strcpy
alpha-beta-pruning
drools-guvnor
frisby.js
ios-enterprise
azure-worker-roles
nest-initiative
step
xpand
yandex-api
sigma-grid-control
data-layers
codio
autofilter
facebook-likebox
xcode6.1-gm-seed
grunt-contrib-imagemin
ie-developer-tools
infomaker
maven-webstart-plugin
servicemanager
ftpwebrequest
moonscript
shapado
sqlbuddy
clgeocoder
mscorlib
cherokee
session-hijacking
mismatch
onunload
p4.net
mysql-pconnect
appointment
cons

Resources

Encrypt Message