jeudi 11 août 2022

Why I am keep getting "Element type is invalid" error with react-native-community checkbox?

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

import React, { useState } from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
import CheckBox from '@react-native-community/checkbox';

export default function Checkbox() {
    const [state, setState] = useState({ react: false });
    return (
        <View>
            <CheckBox
                value={state.react}
                onValueChange={value =>
                    setState({
                        ...state,
                        react: value,
                    })
                }
            />
            <Text>React js</Text>
        </View>
    );
}



Aucun commentaire:

Enregistrer un commentaire