setup
setup(pragma: Function, prefixer?: Function, theme?: Function, forwardProps?: Function)
The call to setup()
should occur once only. It should be called in the entry file of you project.
Given the fact that react
uses createElement
for the transformed elements and preact
uses h
, setup
should be called with the proper pragma function. This was added to reduce the bundled size and being able to bundle esmodule version. At the moment I think it's the best tradeoff we can have.
#
With prefixer#
With theme#
With forwardPropsThe forwardProps
function, offers a way to achieve the same shouldForwardProps
functionality as emotion and styled-components(with transient props) offer. The difference in here is that the function receives the whole props and you are in charge of removing the props that are should not end-up in the dom.
This is a super useful functionality when paired with theme object, variants or any other customisation one might need.
Alternatively you can use goober/should-forward-prop
addon, to pass only the filter function and not have to deal with the full props
object.