Category : jsx

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of App. Nose por que cuando escribo la funcion en App en indez.js me marca ese Error App.js import Curso from "./curso"; const App = () => ( <Fragment> <div className="main-banner ..

Read more

I need to annotate my JSX with comments for a ternary operator, but the following doesn’t work: { errorObj.message ? <Error msg={formatError(errorObj)} /> : {/* If the current Route is non-Home, and appData/userInfo have not been loaded yet, redirect to NotAuthorized */} (currentRoute && currentRoute !== ‘/’ && (appData === null || userInfo === null)) ..

Read more

I have TreeView Material UI. I’m using it to show data. I want to expand and collapse at the same time. The code I have done: <TreeView className={classes.root1} defaultExpandIcon={<ArrowDropDownIcon />} defaultCollapseIcon={<ArrowDropUpIcon />} defaultEndIcon={<ArrowDropDownIcon />} disableSelection={true} expanded={expanded} > {renderTree(row, index)} </TreeView>; Here is the function which I’m calling: const [expanded, setExpanded] = useState(["1"]); const renderTree = ..

Read more

This is my frontend React code: import * as React from ‘react’; import { useEffect, useState } from ‘react’; import http from ‘./http-common’; // axios type Photo = { filename: string, caption: string, tags: string[]. }; const BrowserArticle = ({ filename, caption, tags }: Photo) => { const [photoFile, setFile] = useState<string>(”); useEffect(() => { ..

Read more

In a function, I have a button that displays a component on click. How do I hide this component when clicking on that button again (which would work like a toggle)? <Link to="/"> <div className="navigation"> <button className="about-button" > About </button> </div> </Link> <Switch> <Route path="/" exact> <HomePage /> </Route> </Switch> Source: Ask Javascript..

Read more