mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 01:11:26 +08:00
19 lines
477 B
TypeScript
19 lines
477 B
TypeScript
|
import React, { useState } from 'react';
|
||
|
import { Affix, Button } from 'antd';
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const [container, setContainer] = useState<HTMLDivElement | null>(null);
|
||
|
|
||
|
return (
|
||
|
<div className="scrollable-container" ref={setContainer}>
|
||
|
<div className="background">
|
||
|
<Affix target={() => container}>
|
||
|
<Button type="primary">Fixed at the top of container</Button>
|
||
|
</Affix>
|
||
|
</div>
|
||
|
</div>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|