A
A
Alexander Ivanov2021-01-22 11:42:23
React
Alexander Ivanov, 2021-01-22 11:42:23

How to fix "React does not recognize" styled-components error?

Warning (error) text:

React does not recognize the `fullSize` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `fullsize` instead. If you accidentally passed it from a parent component, remove it from the DOM element.


Style file code
import styled, { css } from 'styled-components'
export const Link = styled.a`
  ${(p) => p.fullSize && css`
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
  `}
  color: inherit;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.6px;
`


Inside a component
import { Link } from './asas'

class MobileMenu extends Component {
   ...


    return (
                <Link
                  fullSize
                  as={Link}
                  to={item.href}
                  onClick={onClose}
                >
                  {i18n.t(item.title)}
                </Link>
    )
}


React is not my main stack. The piece described above is from a large project, and there are a lot of similar errors. Before starting, I had to add exceptions to .eslintrc.yml and also rewrite several file paths, because were in a terrible state and sometimes referred to the wrong file (../../../). Before me, the project had not been corrected for about a year. I'm not really catching up on how to fix the "bug". I would be grateful if you tell me.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2021-01-22
@cimonlebedev

I don't think it's a solution, but it's not an error

<MenuHead key={index}>
                <MenuLink
                  fullsize=""
                  as={Link}
                  to={item.href}
                  onClick={onClose}
                >
                  {i18n.t(item.title)}
                </MenuLink>
              </MenuHead>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question