Hyperapp: Textarea doesn't update it's value

Created on 20 May 2018  路  2Comments  路  Source: jorgebucaran/hyperapp

Textarea message isn't updated on value change. I

const textareaView = () => (state, actions) => h(
  'textarea',
  {
    oninput(e) {
      actions.setMessage(e.target.value);
    },
  },
  [state.message]
)

Actions has method to reset state.message:

actions.resetMessage = () => (state) => ({
    ...state,
    message: '',
});

When resetMessage is called, state's value resets properly and redraws the view except of textarea.

Example.

Inquiry

Most helpful comment

Thanks, @SkaterDad.

Sounds like this is resolved now.

All 2 comments

Instead of setting the textarea's children, you need to set it's value attribute.

const textareaView = () =>(state, actions) => h(
  'textarea',
  {
    oninput(e) {
      actions.setMessage(e.target.value);
    },
    value: state.message
  }
)

Thanks, @SkaterDad.

Sounds like this is resolved now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jamen picture jamen  路  4Comments

SkaterDad picture SkaterDad  路  3Comments

guy-kdm picture guy-kdm  路  4Comments

jorgebucaran picture jorgebucaran  路  4Comments

icylace picture icylace  路  3Comments