mirror of
https://github.com/infeng/react-viewer.git
synced 2025-12-08 17:36:40 +00:00
27 lines
642 B
JavaScript
27 lines
642 B
JavaScript
const React = require('react');
|
|
const Viewer = require('../dist/index').default;
|
|
|
|
function App () {
|
|
const [ visible, setVisible ] = React.useState(false);
|
|
|
|
const images = [
|
|
{
|
|
src:
|
|
"https://infeng.github.io/react-viewer/59111ff2c38954887bc313887fe76e27.jpg"
|
|
},
|
|
{
|
|
src:
|
|
"https://infeng.github.io/react-viewer/bbbc41dac417d9fb4b275223a6a6d3e8.jpg"
|
|
}
|
|
];
|
|
|
|
return (
|
|
<div>
|
|
<button onClick={() => { setVisible(true); }}>{visible ? 'close' : 'open'}</button>
|
|
<Viewer images={images} visible={visible} onClose={() => { setVisible(false); }} />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
module.exports = App;
|