MCPcopy
hub / github.com/pmndrs/react-spring / HomeBlockTarget

Function HomeBlockTarget

docs/app/components/HomeBlocks/HomeBlockTarget.tsx:93–163  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91const dataFixtures = [webHtml, nativeHtml, threeHtml, konvaHtml, zdogHtml]
92
93export const HomeBlockTarget = () => {
94 const [index, setIndex] = useState(0)
95
96 const transition = useTransition(index, {
97 from: {
98 opacity: 0,
99 },
100 enter: {
101 opacity: 1,
102 },
103 leave: {
104 opacity: 0,
105 },
106 config: {
107 duration: 800,
108 precision: 0.0001,
109 },
110 })
111
112 useIsomorphicLayoutEffect(() => {
113 const interval = setInterval(() => {
114 setIndex(s => (dataFixtures.length - 1 === s ? 0 : s + 1))
115 }, 4000)
116
117 return () => {
118 clearInterval(interval)
119 }
120 }, [index])
121
122 return (
123 <section className={section}>
124 <HomeBlockCopy
125 subtitle="But wait, there’s more"
126 title="It’s not just for web"
127 cta={{
128 label: 'Learn more about targets',
129 href: '/docs/concepts/targets',
130 }}
131 >
132 <p>Choose from our five targets:</p>
133 <ul className={list}>
134 <li>web</li>
135 <li>native</li>
136 <li>three</li>
137 <li>konva</li>
138 <li>zdog</li>
139 </ul>
140 <p>
141 Missing a target you want? Request we add it or create it yourself
142 with our advanced API usage.
143 </p>
144 </HomeBlockCopy>
145 <pre className={clsx(pre, homeBlockCode)}>
146 <code
147 className="language-jsx"
148 dangerouslySetInnerHTML={{ __html: dataFixtures[0] }}
149 style={{
150 visibility: 'hidden',

Callers

nothing calls this directly

Calls 1

useTransitionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…