'ValueChanging' does not exist on type 'Readonly<{}>'

后端 未结 2 1917
执笔经年
执笔经年 2021-02-19 09:54

I\'m trying to implement a handler, in React, for a survey implemented in SurveyJS. This is for multiple-choice questions that may have answers like \"None of the Above\" or \"P

相关标签:
2条回答
  • 2021-02-19 10:14

    FYI: We have introduce this functionality into SurveyJS Library sometimes ago.

    Here is the react example with "Select All" and "None of the Above" features, out of the box, without custom code.

    Thank you!

    0 讨论(0)
  • 2021-02-19 10:19

    The most likely cause for this is that you don't specify the type for your component's state in its class definition, so it defaults to {}. You can fix it by declaring interfaces for the types of props and state and providing these as type arguments to React.Component:

    interface MyComponentProps { /* declare your component's props here */ }
    interface MyComponentState { ValueChanging :  boolean }
    
    class MyComponent extends React.Component<MyComponentProps, MyComponentState> {
      constructor(props) {
      ...
    

    You could provide the types directly between the < and >, but using interfaces usually leads to more readable code and promotes reuse. To prevent confusion with components it's also a good idea to use lower-case identifiers for the properties on props and state.

    0 讨论(0)
提交回复
热议问题