question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Getters` in redux-form props

See original GitHub issue

Redux form provide wide list of props - http://redux-form.com/6.6.0/docs/api/Props.md/ One can find a lot of write commands, and a few constants one can read(ie form).

But there is not build in command to read value from or, for example, get current variable prefix from FormSection (to build name to read). First case can be solved via Selectors, but it will not be easy, and clear - you should combine state and form name. And you dont know form name. Second can can not be solved.

What about embedding selectors inside first-level props?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
tstirrat15commented, Apr 12, 2017

@theKashey are you talking about a field’s other attributes, such as syncError or dirty? There are other ways of obtaining that information, such as through selectors.

1reaction
erikrascommented, Apr 9, 2017

The main reason why you need a selector rather than a this.props.get(fieldName) is that a selector will rerender your component, and the other won’t.

One of the main design goals of v6 was to allow individual fields to be rerendered without necessarily having to rerender the entire form.

For a contrived example, let’s say you want to print out “full name” in your form, so you do:

<div>{`${this.props.get('firstName')} ${this.props.get('lastName')}`}</div>

As you type into the firstName field, you would expect the Full Name <div> to change, but it won’t, because the form’s render() method is not being called on every keypress.

Make sense?

Read more comments on GitHub >

github_iconTop Results From Across the Web

props - Redux Form
Sets the value and marks the field as autofilled in the Redux Store. This is useful when a field needs to be set...
Read more >
props - Redux Form
Sets the value and marks the field as autofilled in the Redux Store. This is useful when a a field needs to be...
Read more >
Selecting Form Values Example - Redux Form
... submitting } = props return ( <form onSubmit={handleSubmit}> <div> <label>First Name</label> <div> <Field name="firstName" component="input" type="text" ...
Read more >
How can I insert a reduxForm component without starting too ...
I am using a MERN stack overall, but I think this question only applies to react and redux form. Whenever I include a...
Read more >
Create Forms Easily with React and Redux
LocalForm (props); function react-redux-form.batched (reducer, initialState) ... localPath, getter(initialState, localPath)); default: return state; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found