Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
value={{
router: this.router,
match: renderArgs,
}}
>
{element}
);
}
}
BaseRouter.propTypes = propTypes;
// FIXME: For some reason, using contextType doesn't work here.
return mapContextToProps(
{
consumers: ReactReduxContext,
mapToProps: ({ store }) => ({ store }),
displayName: 'withStore(BaseRouter)',
},
BaseRouter,
);
}
return (
);
}
}
export default mapContextToProps(
[SelectableContext, TabContext],
(parentOnSelect, tabContext, { role }) => {
if (!tabContext) return { parentOnSelect };
const { activeKey, getControllerId, getControlledId } = tabContext;
return {
activeKey,
parentOnSelect,
role: role || 'tablist',
// pass these two through to avoid having to listen to
// both Tab and Nav contexts in NavLink
getControllerId,
getControlledId,
};
},
AbstractNav,
function createBootstrapComponent(Component, opts) {
if (typeof opts === 'string') opts = { prefix: opts };
const isClassy = Component.prototype && Component.prototype.isReactComponent;
// If it's a functional component make sure we don't break it with a ref
const { prefix, forwardRefAs = isClassy ? 'ref' : 'innerRef' } = opts;
return forwardRef(
// eslint-disable-next-line react/prop-types
({ className, float, ...props }, ref) => {
props[forwardRefAs] = ref;
const prefixes = useContext(ThemeContext);
let floats = null;
if (float && Object.keys(float).length > 0) {
floats = Object.entries(float).reduce(
(acc, [property, value]) =>
acc +
(property !== 'default'
? `float-${property}-${value} `
: `float-${value} `),
'',
);
}
return (
export default function withRouter(Component) {
return mapContextToProps(
{
consumers: RouterContext,
mapToProps: context => context,
displayName: `withRouter(${Component.displayName || Component.name})`,
},
Component,
);
}
if (!registerNode) return;
registerNode(parseInt(h, 10), title, id);
}
render() {
const { h, id, children, className } = this.props;
const H = `h${h}`;
return (
<div>{children}</div>
);
}
}
export default mapContextToProps(
TocContext,
c => ({ registerNode: c.registerNode }),
Heading,
);