Answer the question
In order to leave comments, you need to log in
How to describe reduce and css styled-component types?
Can't describe types in this function which is used to apply css properties in media-query
import React from 'react';
import styled, { css } from 'styled-components';
const size: MediaQueryProps = {
small: 400,
med: 960,
large: 1140,
};
const above = Object.keys(size).reduce((acc, cur) => {
acc[cur] = (...args:any) => css`
@media (min-width: ${size[cur]}px) {
${css(...args)}
}
`;
return acc;
}, {} as any);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question