R
Reactiflux

Server ErrorError: Element type is invalid: expected a string (for built-in components)...

Server ErrorError: Element type is invalid: expected a string (for built-in components)...

GGeethika5/7/2023
I am getting this error in console and also when I go to the page personal-info in my next.js project! ---> Server Error Error: 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. I am trying to route to personal-info page from sign up page. Code snippets: >> Function that handles what happens after recieveing sign up OTP , const handleOtp = async (otpNumber, phoneNumber,userPassword) => { try { setLoading(true); .... if (error) throw error; else { alert("Welcome!"); router.push('/personal-info') } ... } catch (error) { //console.log(phoneNumber, otpNumber,userPassword); alert(error.error_description || error.message); } finally { setLoading(false); } }; >> Personal info page code import PersonalDetails from "../components/PersonalDetails" const PersonalInfo = () => { return ( <> <PersonalDetails/> </> ) } export default PersonalInfo >> Personal details page code snippets ... const goToHomePage = () => { router.push('/') } ... <Button size="lg" className="button block" onClick={goToHomePage} > <span>Save</span> </Button> ...
UUUnknown User5/7/2023
Message Not Public
Sign In & Join Server To View
GGeethika5/7/2023
I have formatted the code Please check I think we can rule out the first option
UUUnknown User5/7/2023
Message Not Public
Sign In & Join Server To View
GGeethika5/7/2023
actually that's not possible you can tell me if u need to see any additional code
UUUnknown User5/7/2023
Message Not Public
Sign In & Join Server To View
GGeethika5/8/2023
okay, I will check n update So I found the soln. to the problem from : https://stackoverflow.com/questions/39047130/react-bootstrap-importing-modules . " react-bootstrap doesn't have a default export, so the default import syntax (import ReactBootstrap from 'react-bootstrap') cannot be used in this case. You can do the following though: import * as ReactBootstrap from 'react-bootstrap'; <ReactBootstrap.Button bsStyle="success" bsSize="small"> Something </ReactBootstrap.Button> "
UUUnknown User5/8/2023
Message Not Public
Sign In & Join Server To View

Looking for more? Join the community!

R
Reactiflux

Server ErrorError: Element type is invalid: expected a string (for built-in components)...

Join Server