feat(example): example done
This commit is contained in:
1 parent
8f13dec0e4
commit
2c767eefe6
11 files changed
+193
-22
No files matched your search
+18
-1
@@ -1,10 +1,27 @@
|
||||
import { useState } from 'react';
|
||||
import './App.css';
|
||||
import { Parent } from './children-render/parent';
|
||||
import { ParentFixed } from './children-render-fixed/parent-fixed';
|
||||
import { FamilyContextProvider } from './children-render-fixed/family-context';
|
||||
|
||||
const App = () => {
|
||||
const [version, setVersion] = useState<'normal' | 'fixed'>('normal');
|
||||
|
||||
return (
|
||||
<div className="content">
|
||||
<Parent />
|
||||
<button
|
||||
className="version__toggle"
|
||||
onClick={() => setVersion(version === 'normal' ? 'fixed' : 'normal')}
|
||||
>
|
||||
Go to {version === 'normal' ? 'fixed' : 'normal'}
|
||||
</button>
|
||||
{version === 'normal' ? (
|
||||
<Parent />
|
||||
) : (
|
||||
<FamilyContextProvider>
|
||||
<ParentFixed />
|
||||
</FamilyContextProvider>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user