Skip to content

ReactR state and other components #32

@MarkusLang1987

Description

@MarkusLang1987

Hello,

first of all thank you for the awesome package. I love both technologies and played with it a bit.
In the documentation I found no way to pass state or child components.

class App extends React.Component {
  constructor() {
    super();
    this.state = {
      isFlipped: false
    };
    this.handleClick = this.handleClick.bind(this);
  }
 
  handleClick(e) {
    e.preventDefault();
    this.setState(prevState => ({ isFlipped: !prevState.isFlipped }));
  }
 
  render() {
    return (
      <ReactCardFlip isFlipped={this.state.isFlipped} flipDirection="vertical">
        <YOUR_FRONT_CCOMPONENT key="front">
          This is the front of the card.
          <button onClick={this.handleClick}>Click to flip</button>
        </FrontComponent>
 
        <YOUR_BACK_COMPONENT key="back">
          This is the back of the card.
          <button onClick={this.handleClick}>Click to flip</button>
        </BackComponent>
      </ReactCardFlip>
    )
  }
}

ReactDOM.render(<App />, document.querySelector("#pivot-example"));

I would like to use this Flip Card Component for example. It is possible to pass state? This Component also only works with Childcomponents. Is there a way to pass an Actionbutton for example?

Thank you :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions