Commit 8a8b5ac2 authored by Tasso Evangelista's avatar Tasso Evangelista
Browse files

Add unmemoized Box

parent d9903bfc
......@@ -26,7 +26,7 @@ const transforms = [
mapClassNames,
];
export const Box = memo(forwardRef(function Box(props, ref) {
export const UnmemoizedBox = forwardRef(function Box(props, ref) {
useStyleSheet();
const contextProps = useContext(PropsContext);
......@@ -39,7 +39,9 @@ export const Box = memo(forwardRef(function Box(props, ref) {
}
return children;
}));
});
export const Box = memo(UnmemoizedBox);
Box.propTypes = {
is: PropTypes.elementType,
......
import { storiesOf } from '@storybook/react';
import React, { StrictMode, useEffect, useState, useRef } from 'react';
import { Box, Margins } from '../..';
import { Box, Margins, UnmemoizedBox } from '../..';
const MountTest = ({ children }) => {
const [length, setLength] = useState(10);
......@@ -55,3 +55,24 @@ storiesOf('Box/Performance', module)
.lokiSkip('With margin Prop', () => <MountTest>
{(i) => <Box key={i} margin='none' />}
</MountTest>);
storiesOf('Box/Performance/Unmemoized', module)
.addParameters({
jest: ['Box/spec'],
docs: { disable: true },
})
.addDecorator((fn) => <StrictMode>{fn()}</StrictMode>)
.lokiSkip('Without Props', () => <MountTest>
{(i) => <UnmemoizedBox key={i} />}
</MountTest>)
.lokiSkip('With is Prop', () => <MountTest>
{(i) => <UnmemoizedBox key={i} is='button' />}
</MountTest>)
.lokiSkip('With Margins', () => <MountTest>
{(i) => <Margins key={i}>
<UnmemoizedBox/>
</Margins>}
</MountTest>)
.lokiSkip('With margin Prop', () => <MountTest>
{(i) => <UnmemoizedBox key={i} margin='none' />}
</MountTest>);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment