Skip to content

example using the State Hook no readme :) #113

Description

@tamaracosta

import { useState } from 'react';
import ReactCardFlip from 'react-card-flip';

const Card = () => {
const [isFlipped, setIsFlipped] = useState(false)

function handleClick(e) {
e.preventDefault();
setIsFlipped(!isFlipped);
}

return (
<>

<YOUR_FRONT_CCOMPONENT>
This is the front of the card.
Click to flip
</YOUR_FRONT_CCOMPONENT>

    <YOUR_BACK_COMPONENT>
      This is the back of the card.
      <button onClick={handleClick}>Click to flip</button>
    </YOUR_BACK_COMPONENT>       
  </ReactCardFlip>
</>

)
}

export default Card;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions