Javascript how to show each element of array on a new line

前端 未结 3 1569
小鲜肉
小鲜肉 2021-02-02 15:21

I have a string build form comma separated values I use split to get each value and after that I want to show each value on a new line but what really happens is th

3条回答
  •  盖世英雄少女心
    2021-02-02 15:49

    Link: https://snack.expo.io/GcMeWpPUX

    import React from 'react'
    import { SafeAreaView, Text, View, FlatList } from 'react-native'
    
    export default class App extends React.Component {
    
        render() {
            return (
                
                     String(index)}
                        renderItem={({ item, index }) => {
                            return (
                                {item.skills.splice(',').join("\n")}
                            )
                        }}
                    />
    
                
            )
        }
    
    }
    
    
    const your_array_name = [
        {
            id: 1,
            text: 'Lorem ipsum is simple dummy text for printing the line',
            skills: ['javascript', 'java']
        },
        {
            id: 2,
            text: 'Lorem ipsum is simple dummy text.',
            skills: ['javascript', 'java']
        }]
    

提交回复
热议问题