#Can't use template literal to set Affix component prop

4 messages · Page 1 of 1 (latest)

clever flint
#

https://codesandbox.io/s/still-surf-ssvpf0?file=/src/App.tsx

Context: I'm using affix to make some text/image pop up.

  1. In Dog.tsx, I pass in component props for Affix but the passed props don't seem to work
<Affix position={{ bottom: `${b}`, right: `${r}` }}>

The values look correct when I display them as text.

swift magnet
#

Missing px?

<Affix position={{ bottom: `${b}px`, right: `${r}px` }}>
molten hamlet
#

You can pass the values without template literal if you want to use px

<Affix position={{ bottom: b, right: r }}>

pure lily