You need to stop relying upon hoisting as all of your examples would throw an eslint error. For example, you are calling CollapseWrapper before it has been declared and this is consistent throughout your code unless you are actually hoisting functions by intent declare the pointer first.
This is a standard way of use Styled Components in React but thanks for your comment. If you dont link to use it this way you can put the styled component on another file
I understand what you are trying to say but, is not true.
You will not get any linting error, if you quickly install eslint and extend airbnb preset or even react-standard for instance on my demo you will see that no error or warning will show up.
Declaring styled-components in react at the end of the file is not consider bad practice either.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You need to stop relying upon hoisting as all of your examples would throw an eslint error. For example, you are calling
CollapseWrapper
before it has been declared and this is consistent throughout your code unless you are actually hoisting functions by intent declare the pointer first.This is a standard way of use Styled Components in React but thanks for your comment. If you dont link to use it this way you can put the styled component on another file
My comment was purely about your javascript. The code you have given us as an example would fail when run through eslint.
Please be careful sharing code that is bad practice as you are encouraging others to write code in this way.
I understand what you are trying to say but, is not true.
You will not get any linting error, if you quickly install eslint and extend airbnb preset or even react-standard for instance on my demo you will see that no error or warning will show up.
Declaring styled-components in react at the end of the file is not consider bad practice either.