Reputation: 23
I need to import multiple css files conditionally in react native project like
import React, { Component } from "react";
if(this.state.language = "he"){
import styles from "./he";
}else{
import styles from "./en";
}
But it's not working. I need to add 2 different CSS for LTR and RTL based on language.
Upvotes: 0
Views: 809
Reputation: 3192
You can do like the following code
import heStyles from "./he";
import enStyles from "./en";
const styles = this.state.language = "he" ? heStyles : enStyles;
Upvotes: 1