teleport-code-generators icon indicating copy to clipboard operation
teleport-code-generators copied to clipboard

Set default value for a state def as a prop reference

Open alexnm opened this issue 5 years ago • 0 comments

This is not necessarily a common case, but it appears in a lot of examples, where you would define a component in React for example:

class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      isActive: props.defaultActive
    }
  }
}

This would require using the UIDLDynamicReference or UIDLStaticValue as defaultValue for a state key inside stateDefinitions.

alexnm avatar Jul 02 '19 10:07 alexnm