ReferenceError: Stars is not defined

I have develop the restaurent star rating , i have this error . I am new to lear reat native please resolve my problem what is the error and edit my code.

import React from 'react';

import { View } from 'react-native';

import Icon from 'react-native-vector-icons/FontAwesome';

export default Stars = ({ rating }) => {
    const stars = [...Array(Math.ceil(rating))];

    return (
        <View style={{
            flexDirection: 'row'
        }}>
            {
                stars.map((_, i) => {
                    const name = Math.floor(rating) > i ? 'star' : 'star-half';

                    return <Icon key={i} name={name} color="#FFD64C" />
                })
            }
        </View>
    )
}

Answer

This is plain JavaScript. It has nothing to do with React Native.

You can’t combine a default export and an assignment.

You are getting the error because the parser gets as far as export default Stars and hasn’t see a Stars defined.

Do this in two steps:

const Stars = (...) => { ... };

export default Stars;