mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 01:19:45 +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;
|