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.

issue with updating textarea state?

See original GitHub issue

I’ve modified the getting started code to keep it as minimal as possible:

Expected behavior

When I click reset, I’m expecting the textarea’s value to be an empty string:

expected

Actual behavior

bug

Steps to reproduce behavior

Use this code to get the buggy application to work:

const choo = require('choo')
const html = require('choo/html')
const app = choo()

app.model({
  state: { title: 'Not quite set yet' },
  reducers: {
    update: (data, state) => ({ title: data }),
    reset: (data, state) => ({ title: '' })
  }
})

const mainView = (state, prev, send) => html`
  <main>
    <h1>Title: ${state.title}</h1>
    <textarea
      type="text"
      oninput=${(e) => send('update', e.target.value)}
    >${state.title}</textarea>
    <button onclick=${(e) => send('reset')}>reset</textarea>
  </main>
`

app.router((route) => [
  route('/', mainView)
])

const tree = app.start()
document.body.appendChild(tree)

Add value=${state.title} to the textarea to get the desired behaviour.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
yoshuawuytscommented, Oct 9, 2016

@emanchado odd, yeah can confirm. Still seems like a morphdom issue - would you mind raising it there?

edit: requirebin link

1reaction
yoshuawuytscommented, Sep 13, 2016

@maximilianschmitt a morphdom patch was released 18 hours ago (you posted it 10 hours ago) - maybs it got fixed?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReactJS component textarea not updating on state change
I'm trying to write a note taking/organizing app and I've run into a frustrating bug. Here's my component: import React from ' ...
Read more >
TextArea and TextField change of state not updating the value
Basically what i am trying to do is to reset the text input inside TextArea component. The code is simple. Which i am...
Read more >
dcc.Textarea - Dash for Python Documentation - Dash Plotly
dcc.Textarea. dcc.Textarea is a wrapper around the <textarea//> HTML component. It is similar to dcc.Input except that it allows for multiple lines of...
Read more >
Forms - React
In HTML, form elements such as <input> , <textarea> , and <select> typically maintain their own state and update it based on user...
Read more >
React TextArea value not automatically updating as expected ...
To resolve this issue, make sure that you're passing a "non-undefined" value to the textareas value prop which will cause the textarea element...
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