Skip to content

Using extend to create a class of a react component shows me an error for initialState #4304

@reduxdj

Description

@reduxdj

Maybe i don't understand why? But what's the alternative?

Warning: getInitialState was defined on CampaignList, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?
3vendor.js:21739 Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op.

class CampaignList extends React.Component
  getInitialState: ->
    {empty:true}

..and

 <div className={className}>
      <Sidebar>
        <CampaignForm/>
      </Sidebar>
      <ContentBox>
        <div className="content-header">
          <h1 className="col-xs-12 col-md-6">Campaigns</h1>
          <div className="col-xs-10 col-md-3 btn btn-utility btn-campaign col-md-offset-3" onClick={@handleClick}>+ Create a new Campaign</div>
        </div>
        <CampaignList/>
      </ContentBox>
    </div>
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions