Last active
May 8, 2018 14:02
-
-
Save zilahir/0a7e4af0d00a067c5667110a035b5e4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { Grid, Row, Col } from 'react-flexbox-grid'; | |
import { Cta } from './'; | |
import Api from './../../data'; | |
import ApiHun from './../../dataHun'; | |
class Faq extends Component { | |
componentDidMount() { | |
let language = this.props.lang; | |
if (language === 'en') { | |
console.log(language); | |
} | |
} | |
render() { | |
return() { | |
<Col> | |
{ | |
Api.getFaqText().map(b => { | |
if (b.id === 1) | |
return <BHead textClass={b.classname} key={b.id} title={(<div dangerouslySetInnerHTML={{__html: b.title}} />)} /> | |
}) | |
} | |
</Col> | |
} | |
} | |
} | |
export { Faq }; | |
//data.js | |
const Data = { ... } // some json | |
export default Data; | |
//dataHun.js --> the same | |
//the question: how can i change the map function based on the props? | |
//this is notwirking: | |
/* | |
{ | |
if (language === 'en') | |
{ | |
Api.getFaqText().map(b => { | |
if (b.id === 1) | |
return <BHead textClass={b.classname} key={b.id} title={(<div dangerouslySetInnerHTML={{__html: b.title}} />)} /> | |
}) | |
} | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment