This package provides react application pointcut code, acting as a target toggle point injected by @asos/web-toggle-point-webpack/plugin
It contains the following exports:
withTogglePointFactory
This is a factory function used to create a withTogglePoint
react higher-order component.
withToggledHookFactory
This is a factory function used to create a hook-wrapping function.
The product of both these factories receive the outcome of the webpack plugin, used to choose appropriate variants at runtime, based on decisions from a supplied context.
Both accept plugins, currently supporting a hook called during code activation (mounting of the component, or calling the hook).
See: JSDoc output
Warning
The package should work with React 17 and above, but due to a bug that they are not back-filling, the use of "type": "module"
in the package means webpack will be unable to resolve the extensionless import.
To fix, either upgrade to React 18+ or add the following resolve configuration to the webpack config:
resolve: {
alias: {
"react/jsx-runtime": "react/jsx-runtime.js"
}
}