Home Reference Source
import {Component} from 'simpledom-component'
public class | source

Component

Class for a component.

  class HelloWorldComponent extends Component {
     render() {
         return (
             <h1>{this.props.message}</h1>
         );
     }
  }

  renderToDom('container', <HelloWorldComponent messsage="Hello World!"/>);

Static Member Summary

Static Public Members
public static

Constructor Summary

Public Constructor
public

constructor(props: Object, store: Store)

Constructor of a component.

Member Summary

Public Members
public
public

node: Node

Parent node of the component.

public
public

The props (attributes pass to dom node + children).

public get

The state of the current store

public

The store share between all components.

Method Summary

Public Methods
public abstract

Method called after rendered into DOM.

public

Method to implement to react when an event that does not imply re rendering is sent to Store

public

Method to implement to react when an event is send to Store

public

mustRefresh(oldState: Object, newState: Object): boolean

Return false to avoid call to render on an event.

public

nodeRefHandler(node: Node)

Do not touch :)

public

react(event: String)

Method to implement called when an event that does not imply re rendering is sent to Store

public

reactToChangeState(event: string, newState: Object, oldState: Object)

Internally method which is called when an event of eventsToSubscribe You can override the method if you want a specific

public

Method to call to refresh the component without the use of the store.

public abstract

Method to implement to render something.

public

renderComponent(otherRef: *): Component | Object

Method use internally to render a component.

Static Public Members

public static isComponent: * source

Public Constructors

public constructor(props: Object, store: Store) source

Constructor of a component.

Params:

NameTypeAttributeDescription
props Object

the props (attributes pass to dom node + children)

store Store

the store.

Public Members

public componentDidUnmount: * source

public node: Node source

Parent node of the component.

public otherRef: * source

public props: Object source

The props (attributes pass to dom node + children).

public get state: Object source

The state of the current store

public store: Store source

The store share between all components.

Public Methods

public abstract componentDidMount() source

Method called after rendered into DOM.

public eventsToReact(): Array source

Method to implement to react when an event that does not imply re rendering is sent to Store

Return:

Array

array of string events to react without rendering.

public eventsToSubscribe(): Array source

Method to implement to react when an event is send to Store

Return:

Array

array of string events to react.

public mustRefresh(oldState: Object, newState: Object): boolean source

Return false to avoid call to render on an event.

Params:

NameTypeAttributeDescription
oldState Object

the old state.

newState Object

the new state.

Return:

boolean

public nodeRefHandler(node: Node) source

Do not touch :)

Params:

NameTypeAttributeDescription
node Node

parent node of the component.

public react(event: String) source

Method to implement called when an event that does not imply re rendering is sent to Store

Params:

NameTypeAttributeDescription
event String

to react on

public reactToChangeState(event: string, newState: Object, oldState: Object) source

Internally method which is called when an event of eventsToSubscribe You can override the method if you want a specific

Params:

NameTypeAttributeDescription
event string

event received in the store.

newState Object

the new state.

oldState Object

the old state.

public refresh() source

Method to call to refresh the component without the use of the store. Useful for internal state with this.

public abstract render(): Component | Object source

Method to implement to render something.

Return:

Component | Object

This return a component or result of el.

public renderComponent(otherRef: *): Component | Object source

Method use internally to render a component.

Params:

NameTypeAttributeDescription
otherRef *

Return:

Component | Object

This return a component or result of SimpleDom.el.