CSS pseudo elements in React example. Use the following Normal HTML/CSS:
1 2 3 4 5 6 7 8 | <div class="something"><span>Something</span></div> <style> .something::after { content: ''; position: absolute; -webkit-filter: blur(10px) saturate(2); } </style> |
React with inline style:
1 2 3 4 5 6 7 8 | render: function() { return ( <div> <span>Something</span> <div style={{position: 'absolute', WebkitFilter: 'blur(10px) saturate(2)'}} /> </div> ); }, |
The trick is that instead of using ::after in CSS in order to create a new element, you should instead create a new element via React. If you don’t want to have to add this element everywhere, then make a component that does it for you.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.