tbg_props_to_state

React.js helper to transfer initial props to state

Usage no npm install needed!

<script type="module">
  import tbgPropsToState from 'https://cdn.skypack.dev/tbg_props_to_state';
</script>

README

Props to State

How to use

Comp   = React.createClass

  getInitialState: -> 
    TransferToState(@props, 
      current_user: "options.current_user?",
      verification_status: "options.verification_status"
    )

If you also wish to set default state values

Comp   = React.createClass

  getInitialState: -> 
    TransferToState(@props,
      {
        current_user: "options.current_user?",
        verification_status: "options.verification_status"
      },
      {
        display: true
      }
    )