storybook/examples/cra-kitchen-sink/src/stories/force-rerender.stories.js
2022-04-12 14:59:21 +08:00

20 lines
385 B
JavaScript

import React from 'react';
import { forceReRender } from '@storybook/react';
import { Button } from '../components/react-demo';
let count = 0;
const increment = () => {
count += 1;
forceReRender();
};
export default {
title: 'Force ReRender',
};
export const DefaultView = () => (
<Button type="button" onClick={increment}>
Click me to increment: {count}
</Button>
);