{"id":66229,"date":"2021-09-14T09:00:47","date_gmt":"2021-09-14T13:00:47","guid":{"rendered":"https:\/\/blog.logrocket.com\/?p=66229"},"modified":"2024-06-04T17:16:46","modified_gmt":"2024-06-04T21:16:46","slug":"sass-react-native-guide","status":"publish","type":"post","link":"https:\/\/blog.logrocket.com\/sass-react-native-guide\/","title":{"rendered":"How to use Sass in React Native"},"content":{"rendered":"<!DOCTYPE html>\n<html><p>Sass, which stands for \u201cSyntactically Awesome Style Sheets,\u201d is a pre-processor that helps you write, structure, and organize CSS code. It\u2019s widely used today as an alternative to raw CSS for styling large web applications.<\/p><img loading=\"lazy\" decoding=\"async\" width=\"730\" height=\"487\" src=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/using-sass-react-native-guide.png\" class=\"attachment-full size-full wp-post-image\" alt=\"Guide to using Sass in React Native\" srcset=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/using-sass-react-native-guide.png 730w, https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/using-sass-react-native-guide-300x200.png 300w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\">\n<p>In fact, many modern CSS frameworks and libraries like Bootstrap are also written in Sass. It allows developers to use variables, mixins, modules, partials, and operators in their CSS styles.<\/p>\n<p>While Sass is popularly coupled with frontend frameworks like React, you can also use it in your React Native projects. In this guide, I\u2019ll walk you through how you can configure and use Sass in your React Native app, but first, let\u2019s understand how Sass works.<\/p>\n<h2>How Sass works<\/h2>\n<p>Sass is only a development time tool and not an extension to the CSS standard. This means that when you use webpack or a module bundler to build your code, it compiles your Sass files too. In the web ecosystem, your Sass files are saved with the <code>.scss<\/code> extension instead of the regular <code>.css<\/code> extension. The SCSS stands for \u201cSassy CSS\u201d and provides a syntactic sugar that\u2019s similar to CSS.<\/p>\n<p>You can also write raw CSS inside your Sass files because every valid CSS is also a valid SCSS. However, vice versa is not true.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-66238 size-full\" src=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/how-sass-works-web-e1631297670118.png\" alt=\"How Sass Works in Web\" width=\"730\" height=\"548\" srcset=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/how-sass-works-web-e1631297670118.png 730w, https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/how-sass-works-web-e1631297670118-300x225.png 300w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/p>\n<p>Since React Native does not use CSS but style objects, your Sass files are also converted to React Native style objects under the hood.<\/p>\n<p>This gives you an important advantage of writing raw CSS to style your React Native components. Your React Native project compiles your Sass files at runtime and converts them to regular JavaScript objects.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-66241 size-full\" src=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/how-sass-works-react-native-e1631297722366.png\" alt=\"How Sass Works in React Native\" width=\"730\" height=\"548\" srcset=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/how-sass-works-react-native-e1631297722366.png 730w, https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/how-sass-works-react-native-e1631297722366-300x225.png 300w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/p>\n<p>Now that you understand how Sass works, let\u2019s set it up inside our React Native project. For this purpose, we\u2019ll use the package react-native-sass-transformer.<\/p>\n<h2>Set up Sass in React Native<\/h2>\n<p>The react-native-sass-transformer package allows us to easily configure, set up, and use Sass in any kind of React Native project. It also uses the package <code>node-sass<\/code> as a dependency for providing the Node binding to Sass.<\/p>\n<p>Let\u2019s start by creating a new React Native project:<\/p>\n<pre class=\"language-bash hljs\">npx react-native init rn-sass-app\n<\/pre>\n<p>You can install both the dependencies in your project by running the following command:<\/p>\n<pre class=\"language-bash hljs\">npm install react-native-sass-transformer node-sass\n<\/pre>\n<p>Once you have created the project along with the above dependencies, you need to make some additional configurational changes. In the root directory, add the following configurations to your <code>metro.config.js<\/code> file:<\/p>\n<pre>const { getDefaultConfig } = require(\"metro-config\");\n\nmodule.exports = (async () =&gt; {\n  const {\n    resolver: { sourceExts }\n  } = await getDefaultConfig();\n  return {\n    transformer: {\n      babelTransformerPath: require.resolve(\"react-native-sass-transformer\")\n    },\n    resolver: {\n      sourceExts: [...sourceExts, \"scss\", \"sass\"]\n    }\n  };\n})();\n<\/pre>\n<p>If you\u2019re using Expo CLI, you\u2019ll need to explicitly create a <code>metro.config.js<\/code> file inside the root directory. You will also need to tell Expo to load these configurations in the project by making the following adjustments to your <code>app.json<\/code> file:<\/p>\n<pre>{\n  \"expo\": {\n   ...\n    \"packagerOpts\": {\n      \"config\": \"metro.config.js\",\n      \"sourceExts\": [\"js\", \"jsx\", \"scss\", \"sass\"]\n    }\n   ...\n  }\n}\n<\/pre>\n<p>Once the above changes are complete, you\u2019ll be able to use Sass in your Expo CLI or React Native CLI projects.<\/p>\n<h2>Using Sass to style your React Native components<\/h2>\n<p>Inside the project, let\u2019s create a new file called <code>App.scss<\/code> where we can write the Sass styles for our <code>&lt;App\/&gt;<\/code> component. Inside the <code>App.scss<\/code> file, let\u2019s add the following styles:<\/p>\n<pre class=\"language-scss hljs\">.container {\n  display: flex;\n  flex: 1;\n  justify-content: center;\n  align-items: center;\n  background-color: #333;\n}\n<\/pre>\n<p>The above styles are written in pure CSS, but since we\u2019re using the <code>.scss<\/code> extension, our app will be able to compile these styles. Note that we have used a class selector <code>.container<\/code> to define our styles.<\/p>\n<p>In order to use the above styles inside our <code>App.js<\/code> file, we first need to import them:<\/p>\n<pre>import Appstyles from '.\/App.scss';\n<\/pre>\n<p>Let\u2019s simply log the <code>Appstyles<\/code> object to the console to see what these styles look like:<\/p>\n<pre>console.log({Appstyles})\n<\/pre>\n<p>You\u2019ll notice that our CSS styles have been compiled to a plain JavaScript object:<\/p>\n<pre>Object {\n  \"Appstyles\": Object {\n    \"container\": Object {\n      \"alignItems\": \"center\",\n      \"backgroundColor\": \"#333\",\n      \"display\": \"flex\",\n      \"flexBasis\": 0,\n      \"flexGrow\": 1,\n      \"flexShrink\": 1,\n      \"justifyContent\": \"center\",\n    },\n  },\n}\n<\/pre>\n<p>We can now use these styles like any regular React Native styles object inside the <code>App.js<\/code> file:<\/p>\n<pre>export default function App() {\n  return (\n    &lt;View style={Appstyles.container}&gt;\n      &lt;Text&gt;Open up App.js to start working on your app!&lt;\/Text&gt;\n    &lt;\/View&gt;\n  );\n}\n<\/pre>\n<p>The above should make our <code>&lt;App\/&gt;<\/code> component look like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-66243 aligncenter\" src=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/open-app-js-app-component.jpeg\" alt=\"Open App.js Demo\" width=\"540\" height=\"1170\" srcset=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/open-app-js-app-component.jpeg 540w, https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/open-app-js-app-component-138x300.jpeg 138w, https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/open-app-js-app-component-473x1024.jpeg 473w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/p>\n<p>Thus, with Sass you can even write your styles in pure CSS. Let\u2019s refactor our above styles in SCSS now.<\/p>\n<h2>Using variables in Sass<\/h2>\n<p>Sass allows us to create variables to store information that we can use in various style blocks. We can create a Sass variable using the <code>$<\/code> prefix. Let\u2019s create the following variables inside our <code>App.scss<\/code> file:<\/p>\n<pre class=\"language-scss hljs\">$background-color: #333;\n$primary-color: #d3d3d3;\n$font-large: 20px;\n<\/pre>\n<p>Instead of hardcoding font sizes and colors, we can use variables to set different font sizes to texts, background colors to our containers, etc. Let\u2019s use the above variables to style the <code>&lt;View\/&gt;<\/code> and <code>&lt;Text\/&gt;<\/code> component:<\/p>\n<pre class=\"language-scss hljs\">$background-color: #333;\n$primary-color: #d3d3d3;\n$font-large: 20px;\n\n.container {\n  display: flex;\n  flex: 1;\n  justify-content: center;\n  align-items: center;\n  background-color: $background-color;\n  padding: 20px;\n}\n.text {\n  font-weight: 700;\n  text-align: center;\n  font-size: $font-large;\n  color: $primary-color;\n}\n<\/pre>\n<p>Let\u2019s use the above styles inside our <code>App.js<\/code> file:<\/p>\n<pre>export default function App() {\n  return (\n    &lt;View style={Appstyles.container}&gt;\n      &lt;Text style={Appstyles.text}&gt;Open up App.js to start working on your app!&lt;\/Text&gt;\n    &lt;\/View&gt;\n  );\n}\n<\/pre>\n<p>We should now see our <code>&lt;Text\/&gt;<\/code> component styled differently:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-66245 aligncenter\" src=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/open-app-js-text-style.jpeg\" alt=\"Open App.js with the Text Styled\" width=\"540\" height=\"1170\" srcset=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/open-app-js-text-style.jpeg 540w, https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/open-app-js-text-style-138x300.jpeg 138w, https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/open-app-js-text-style-473x1024.jpeg 473w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/p>\n<p>Great! Let\u2019s now look at how we can reuse our styles for different selectors in Sass using inheritance.<\/p>\n<h2>Using inheritance in Sass<\/h2>\n<p>One of the most fruitful features of Sass is that it lets you reuse a set of styles amongst a number of selectors.<\/p>\n<p>Much like how we can define variables for a style rule, we can define a placeholder class that contains a set of style rules using the <code>%<\/code> symbol. We can then reuse these styles wherever we want.<\/p>\n<p>To demonstrate, let\u2019s create some more variables inside our <code>App.scss<\/code> file:<\/p>\n<pre class=\"language-scss hljs\">$light: #fff;\n$purple: purple;\n$blue-violet: blueviolet;\n$box-dimension: 100;\n<\/pre>\n<p>Now, let\u2019s define a placeholder class called <code>box-shared<\/code> that has the following styles:<\/p>\n<pre class=\"language-scss hljs\">%box-shared {\n  box-shadow: 0 0 1px rgba(0, 0, 0, 0.25);\n  border: 1px solid #ccc;\n  padding: 10px;\n  height: $box-dimension;\n  width: $box-dimension;\n  margin-bottom: 100px;\n}\n<\/pre>\n<p>We can now use the styles defined inside our <code>box-shared<\/code> placeholder class in different selectors. The above styles can be used as the general styles we want to associate with any <code>box<\/code> class we want to use.<\/p>\n<p>For instance, let\u2019s say we want to render a white box on the screen. Instead of rewriting the above styles, we can inherit the above styles using the <code>@extend<\/code> keyword:<\/p>\n<pre class=\"language-scss hljs\">.boxWhite {\n  @extend %box-shared;\n  background-color: $light;\n}\n<\/pre>\n<p>The above <code>.boxWhite<\/code> class will contain all the styles defined in <code>box-shared<\/code> class. Let\u2019s render a simple <code>&lt;View\/&gt;<\/code> component to display the above styles:<\/p>\n<pre>export default function App() {\n  return (\n    &lt;View style={Appstyles.container}&gt;\n      &lt;View style={Appstyles.boxWhite}&gt;\n      &lt;\/View&gt;\n    &lt;\/View&gt;\n  );\n}\n<\/pre>\n<p>We should now see a white box on the screen as shown:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-66247 aligncenter\" src=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/white-box-demo-app.jpeg\" alt=\"White Box Demo App\" width=\"540\" height=\"1170\" srcset=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/white-box-demo-app.jpeg 540w, https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/white-box-demo-app-138x300.jpeg 138w, https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/white-box-demo-app-473x1024.jpeg 473w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/p>\n<p>We can use <code>extend<\/code> or inheritance if we want to add similar UI elements that can reuse some common styles. For instance, we can create styles for more boxes of different colors as shown:<\/p>\n<pre class=\"language-scss hljs\">.boxPurple {\n  @extend %box-shared;\n  background-color: $purple;\n}\n.boxBlueViolet {\n  @extend %box-shared;\n  background-color: $blue-violet;\n}\n<\/pre>\n<p>And then use these classes inside our component:<\/p>\n<pre>export default function App() {\n  return (\n    &lt;View style={Appstyles.container}&gt;\n      &lt;View style={Appstyles.boxWhite}\/&gt;\n      &lt;View style={Appstyles.boxPurple}\/&gt;\n      &lt;View style={Appstyles.boxBlueViolet}\/&gt;\n    &lt;\/View&gt;\n  );\n}\n<\/pre>\n<p>The above should render three boxes of different colors as shown:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-66249 aligncenter\" src=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/color-boxes-demo-app.jpeg\" alt=\"Color Boxes Demo App\" width=\"540\" height=\"1170\" srcset=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/color-boxes-demo-app.jpeg 540w, https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/color-boxes-demo-app-138x300.jpeg 138w, https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/color-boxes-demo-app-473x1024.jpeg 473w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/p>\n<p>Awesome! Before we wrap this up, let\u2019s see how Sass allows us to do simple mathematical calculations while writing our styles using operators.<\/p>\n<h2>Using operators in Sass<\/h2>\n<p>We can use operators to dynamically calculate height, width, padding, margin, and other such properties for our elements. Head back to the <code>App.scss<\/code> file and create another variable:<\/p>\n<pre class=\"language-scss hljs\">$box-dimension-lg: 250;\n<\/pre>\n<p>Let\u2019s also create an <code>extend<\/code> class that contains our flexbox styles:<\/p>\n<pre class=\"language-scss hljs\">%flex-box {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n}\n<\/pre>\n<p>Let\u2019s alter the styles of our <code>box-shared<\/code> placeholder class as shown below:<\/p>\n<pre class=\"language-scss hljs\">%box-shared {\n  box-shadow: 0 0 1px rgba(0, 0, 0, 0.25);\n  border: 1px solid #ccc;\n  padding: 10px;\n  height: $box-dimension-lg;\n  width: $box-dimension-lg;\n  margin-bottom: 100px;\n  border-radius: 10px;\n}\n<\/pre>\n<p>Also, let\u2019s update the styles of our <code>boxWhite<\/code> class we used in the previous section:<\/p>\n<pre class=\"language-scss hljs\">.boxWhite {\n  @extend %flex-box;\n  @extend %box-shared;\n  background-color: $light;\n}\n<\/pre>\n<p>If you noticed, we inherited the styles of two classes inside our <code>boxWhite<\/code> class, which is perfectly fine.<\/p>\n<p>I now want to create another box that is always going to have half the height and width of its parent box. Since we\u2019ll render this box inside the white box with the <code>boxWhite<\/code> class, we can use the <code>$box-dimension-lg<\/code> to calculate the height and width of the box:<\/p>\n<pre class=\"language-scss hljs\">.boxInside {\n  @extend %box-shared;\n  background-color: lightblue;\n  height: ($box-dimension-lg\/2);\n  width: ($box-dimension-lg\/2);\n}\n<\/pre>\n<p>Let\u2019s also render this box inside our <code>App.js<\/code> file:<\/p>\n<pre>export default function App() {\n  return (\n    &lt;View style={Appstyles.container}&gt;\n      &lt;View style={Appstyles.boxWhite}&gt;\n        &lt;View style={Appstyles.boxInside}\/&gt;\n      &lt;\/View&gt;\n    &lt;\/View&gt;\n  );\n}\n<\/pre>\n<p>We should now see a box of half the dimensions of its parent box that lies inside it:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-66251 aligncenter\" src=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/box-in-box-demo-app.jpeg\" alt=\"Box in Box Demo App\" width=\"540\" height=\"1170\" srcset=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/box-in-box-demo-app.jpeg 540w, https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/box-in-box-demo-app-138x300.jpeg 138w, https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/box-in-box-demo-app-473x1024.jpeg 473w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/p>\n<p>You can use all the operators like <code>+<\/code>, <code>-<\/code>, <code>*<\/code>, <code>\/<\/code>, and <code>%<\/code> for calculating the values inside your rules.<\/p>\n<h2>Conclusion<\/h2>\n<p>Sass can really simplify your CSS styles and rules with the help of variables and inheritance. It helps you to write more clean and concise styles for your React Native application. You can also reuse your Sass styles easily between your web and React Native projects.<\/p>\n<p>There are <a href=\"https:\/\/blog.logrocket.com\/how-to-write-reusable-css-with-sass\/\" target=\"_blank\" rel=\"noopener\">other useful features that Sass provides<\/a> such as modules, mixins, functions, etc. You can <a href=\"https:\/\/sass-lang.com\/documentation\" target=\"_blank\" rel=\"noopener\">check out the official docs to explore further<\/a>. Until next time!<\/p>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Use Sass in your React Native projects to style your components using variables, inheritance, and operators.<\/p>\n","protected":false},"author":156415655,"featured_media":66254,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2147999,1],"tags":[2109707,2109731],"class_list":["post-66229","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev","category-uncategorized","tag-css","tag-react-native"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to use Sass in React Native - LogRocket Blog<\/title>\n<meta name=\"description\" content=\"Sass is popularly coupled with React, but you can also use it in your React Native projects to style your components.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.logrocket.com\/sass-react-native-guide\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use Sass in React Native - LogRocket Blog\" \/>\n<meta property=\"og:description\" content=\"Sass is popularly coupled with React, but you can also use it in your React Native projects to style your components.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.logrocket.com\/sass-react-native-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"LogRocket Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-14T13:00:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-04T21:16:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/using-sass-react-native-guide.png\" \/>\n\t<meta property=\"og:image:width\" content=\"730\" \/>\n\t<meta property=\"og:image:height\" content=\"487\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Vijit Ail\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vijit Ail\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.logrocket.com\/sass-react-native-guide\/\",\"url\":\"https:\/\/blog.logrocket.com\/sass-react-native-guide\/\",\"name\":\"How to use Sass in React Native - LogRocket Blog\",\"isPartOf\":{\"@id\":\"https:\/\/blog.logrocket.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blog.logrocket.com\/sass-react-native-guide\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blog.logrocket.com\/sass-react-native-guide\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/using-sass-react-native-guide.png\",\"datePublished\":\"2021-09-14T13:00:47+00:00\",\"dateModified\":\"2024-06-04T21:16:46+00:00\",\"author\":{\"@id\":\"https:\/\/blog.logrocket.com\/#\/schema\/person\/d8c7d3001ed668ec8798a5282f4d5698\"},\"description\":\"Sass is popularly coupled with React, but you can also use it in your React Native projects to style your components.\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.logrocket.com\/sass-react-native-guide\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.logrocket.com\/sass-react-native-guide\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.logrocket.com\/sass-react-native-guide\/#primaryimage\",\"url\":\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/using-sass-react-native-guide.png\",\"contentUrl\":\"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/using-sass-react-native-guide.png\",\"width\":730,\"height\":487,\"caption\":\"Guide to using Sass in React Native\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.logrocket.com\/sass-react-native-guide\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.logrocket.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use Sass in React Native\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.logrocket.com\/#website\",\"url\":\"https:\/\/blog.logrocket.com\/\",\"name\":\"LogRocket Blog\",\"description\":\"Resources to Help Product Teams Ship Amazing Digital Experiences\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.logrocket.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.logrocket.com\/#\/schema\/person\/d8c7d3001ed668ec8798a5282f4d5698\",\"name\":\"Vijit Ail\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.logrocket.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cf92ac9ff2bb1e4e7c0e21282d95b58d5e2b61d3da7605504e22cdaabebf5355?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cf92ac9ff2bb1e4e7c0e21282d95b58d5e2b61d3da7605504e22cdaabebf5355?s=96&d=mm&r=g\",\"caption\":\"Vijit Ail\"},\"description\":\"Software Engineer at toothsi. I work with React and NodeJS to build customer-centric products. Reach out to me on LinkedIn or Instagram.\",\"sameAs\":[\"https:\/\/vijitail.dev\",\"https:\/\/www.instagram.com\/vijit__ail\",\"https:\/\/www.linkedin.com\/in\/vijit-ail-376885179\"],\"url\":\"https:\/\/blog.logrocket.com\/author\/vijitail\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use Sass in React Native - LogRocket Blog","description":"Sass is popularly coupled with React, but you can also use it in your React Native projects to style your components.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.logrocket.com\/sass-react-native-guide\/","og_locale":"en_US","og_type":"article","og_title":"How to use Sass in React Native - LogRocket Blog","og_description":"Sass is popularly coupled with React, but you can also use it in your React Native projects to style your components.","og_url":"https:\/\/blog.logrocket.com\/sass-react-native-guide\/","og_site_name":"LogRocket Blog","article_published_time":"2021-09-14T13:00:47+00:00","article_modified_time":"2024-06-04T21:16:46+00:00","og_image":[{"width":730,"height":487,"url":"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/using-sass-react-native-guide.png","type":"image\/png"}],"author":"Vijit Ail","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Vijit Ail","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog.logrocket.com\/sass-react-native-guide\/","url":"https:\/\/blog.logrocket.com\/sass-react-native-guide\/","name":"How to use Sass in React Native - LogRocket Blog","isPartOf":{"@id":"https:\/\/blog.logrocket.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.logrocket.com\/sass-react-native-guide\/#primaryimage"},"image":{"@id":"https:\/\/blog.logrocket.com\/sass-react-native-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/using-sass-react-native-guide.png","datePublished":"2021-09-14T13:00:47+00:00","dateModified":"2024-06-04T21:16:46+00:00","author":{"@id":"https:\/\/blog.logrocket.com\/#\/schema\/person\/d8c7d3001ed668ec8798a5282f4d5698"},"description":"Sass is popularly coupled with React, but you can also use it in your React Native projects to style your components.","breadcrumb":{"@id":"https:\/\/blog.logrocket.com\/sass-react-native-guide\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.logrocket.com\/sass-react-native-guide\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.logrocket.com\/sass-react-native-guide\/#primaryimage","url":"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/using-sass-react-native-guide.png","contentUrl":"https:\/\/blog.logrocket.com\/wp-content\/uploads\/2021\/09\/using-sass-react-native-guide.png","width":730,"height":487,"caption":"Guide to using Sass in React Native"},{"@type":"BreadcrumbList","@id":"https:\/\/blog.logrocket.com\/sass-react-native-guide\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.logrocket.com\/"},{"@type":"ListItem","position":2,"name":"How to use Sass in React Native"}]},{"@type":"WebSite","@id":"https:\/\/blog.logrocket.com\/#website","url":"https:\/\/blog.logrocket.com\/","name":"LogRocket Blog","description":"Resources to Help Product Teams Ship Amazing Digital Experiences","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.logrocket.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.logrocket.com\/#\/schema\/person\/d8c7d3001ed668ec8798a5282f4d5698","name":"Vijit Ail","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.logrocket.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cf92ac9ff2bb1e4e7c0e21282d95b58d5e2b61d3da7605504e22cdaabebf5355?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf92ac9ff2bb1e4e7c0e21282d95b58d5e2b61d3da7605504e22cdaabebf5355?s=96&d=mm&r=g","caption":"Vijit Ail"},"description":"Software Engineer at toothsi. I work with React and NodeJS to build customer-centric products. Reach out to me on LinkedIn or Instagram.","sameAs":["https:\/\/vijitail.dev","https:\/\/www.instagram.com\/vijit__ail","https:\/\/www.linkedin.com\/in\/vijit-ail-376885179"],"url":"https:\/\/blog.logrocket.com\/author\/vijitail\/"}]}},"yoast_description":"Sass is popularly coupled with React, but you can also use it in your React Native projects to style your components.","_links":{"self":[{"href":"https:\/\/blog.logrocket.com\/wp-json\/wp\/v2\/posts\/66229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.logrocket.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.logrocket.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.logrocket.com\/wp-json\/wp\/v2\/users\/156415655"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.logrocket.com\/wp-json\/wp\/v2\/comments?post=66229"}],"version-history":[{"count":6,"href":"https:\/\/blog.logrocket.com\/wp-json\/wp\/v2\/posts\/66229\/revisions"}],"predecessor-version":[{"id":66257,"href":"https:\/\/blog.logrocket.com\/wp-json\/wp\/v2\/posts\/66229\/revisions\/66257"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.logrocket.com\/wp-json\/wp\/v2\/media\/66254"}],"wp:attachment":[{"href":"https:\/\/blog.logrocket.com\/wp-json\/wp\/v2\/media?parent=66229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.logrocket.com\/wp-json\/wp\/v2\/categories?post=66229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.logrocket.com\/wp-json\/wp\/v2\/tags?post=66229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}