Is there way to convert string jsx to React component level in react native?

时间:2017-12-18 05:01:20

标签: parsing react-native

I'm trying to convert "hello" string from a some server to be rendered in React Native.

But even after removing quotes, it is not rendered. The type of the "hello" even after quotes removed is 'string'. It seems 'object' has to be inserted to the render function.

Is there any way we can try this out? Looking at Expo examples, the web client receives the lines of codes that essentially produces the actual app, I think there might be some way around.

Please share any thought with me!

1 个答案:

答案 0 :(得分:0)

I think maybe it is easier to take the “Hello” string and create a jsx object like:

render() {
     const hello = “Hello”; 
     return (<span> {hello} </span> );
}