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.

Parent does not update

See original GitHub issue

Hey,

In my Login Component I have the folowing code where I pass a field down to a specific input component. When I type in the input and submit the form, the email field returns undefined although I have a value.

Did I miss something here? Shouldn’t the parent get updated with the value?

<form onSubmit={form.onSubmit}>
   <Input field={form.$('email')} />
</form>

Input.js

class Input extends React.Component {
  render() {
    const { field } = this.props;

    return (
      <div>
        <div className={s.field}>
          <input {...field.bind()} />
          <label htmlFor={field.id}>
            {field.label}
          </label>
        </div>
        <p>{field.error}</p>
      </div>
    );
  }
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
foxhound87commented, Mar 26, 2017

fixed it?

0reactions
pankajparkarcommented, Dec 6, 2018

@foxhound87 It should have certain sequence, I have ended up with below (typescript)

export default (withStyles as any)(styles)(observer(MyComponent))

Read more comments on GitHub >

github_iconTop Results From Across the Web

Returning data from a Window does not update the parent
The issue arises from the way UI re-rendering works. When the Window is in a separate component, UI updates only happen in that...
Read more >
Parent State not updating when passed data from child ...
I'm trying to create a note-taking application in React. The application should add a new note when an "Add note" button is pressed...
Read more >
Update parent's state from child component : r/reactjs - Reddit
Don't pass updateState down to the child component. What you should do instead is give the child component an onClick prop. Then the...
Read more >
Child component not refreshing when updating data from ...
allorders is coming back with new data, Child LWC data table is not being update with new data. I do not have a...
Read more >
Child component doesn't update on parent change - Help
The CarIndex component show a list of cars and the CarEdit component is used to update the model Car. <!-- CarIndex --> <table>...
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