What is Emotion?
Who uses Emotion?
Why developers like Emotion?
Here are some stack decisions, common use cases and reviews by companies and developers who chose Emotion in their tech stack.
We are in the process of adopting Next.js as our React framework and using Storybook to help build our React components in isolation. This new part of our frontend is written in TypeScript, and we use Emotion for CSS/styling. For delivering data, we use GraphQL and Apollo. Jest, Percy, and Cypress are used for testing.
For Stack Decisions I needed to add Markdown in the decision composer to give our users access to some general styling when writing their decisions. We used React & GraphQL on the #Frontend and Ruby & GraphQL on the backend.
Instead of using Showdown or another tool, We decided to parse the Markdown on the backend so we had more control over what we wanted to render in Markdown because we didn't want to enable all Markdown options, we also wanted to limit any malicious code or images to be embedded into the decisions and Markdown was a fairly large to import into our component so it was going to add a lot of kilobytes that we didn't need.
We also needed to style how the markdown looked, we are currently using Glamorous so I used that but we are planning to update this to Emotion at some stage as it has a fairly easy upgrade path rather than switching over to styled-components or one of the other cssInJs alternatives.
Also we used React-Mentions for tagging tools and topics in the decisions. Typing
@ will let you tag a tool, and typing
# will allow you to tag a topic.
The Markdown options that we chose to support are tags:
If there are anymore tags you'd love to see added in the composer leave me a comment below and we will look into adding them.
When we rebooted our front-end stack earlier this year, we wanted to have a consolidated and friendly developer experience. Up to that point we were using Sass and BEM. There was a mix of HAML views, React components and Angular. Since our ongoing development was going to be exclusively in React, we wanted to shift to an inline styling library so the "wall of classnames" could be eliminated. The ever-shifting landscape of inline CSS libraries for React is sometimes difficult to navigate.
We decided to go with Glamorous for a few reasons:
As you may or may not know, Glamorous has ceased active development and been mostly superseded by Emotion. We are planning to migrate to either Emotion or @styled-components in the near future, and I'll write another Stack Decision when we get there!
- React on the front-end + liberal use of hooks.
- Firebase to handle authentication and database persistence. Firebase makes bootstrapping your app so much easier. Auth, especially when combined with react hooks and context, is really powerful.
- Firebase functions and Algolia to provide full-text search of the recipes.
- Sancho-UI (my own design system) for developing the responsive user interface, and react-spring for providing animations.
- Emotion for handling css because I really love using the
cssprop to style my elements.
I hope the source code can be helpful to some, and would absolutely love contributions!
We use React because it is the best framework to work quickly, cleanly and with good results. The composition paradigms of React are far superior to most other frameworks and allow for creating a smart and logical component tree, that is high performant.
Also it can be used to create great UI in combination with ES6, TypeScript, GraphQL and Emotion, if used right. The ecosystem definitely gives solutions to nearly all problems. And I can only recommend using Gatsby, if you need Server-Side-Rendering!