score:7
Accepted answer
remove curly brace:
const connectedlist = ({ articles }) =>(
articles.map(e=>( // implicit return
<li key={e.id}>{e.title}</li>
)
));
or, using curly brace:
const connectedlist = ({ articles }) => { // no parentheses
return articles.map(e=>( // explicitly use return
<li key={e.id}>{e.title}</li>
)
});
using curly brace in parentheses indicates that you're returning an object. but articles.map... is obviously not an object rather looping through an object.
Source: stackoverflow.com
Related Query
- How to resolve the error Attempted import error: 'react-hook-form' does not contain a default export (imported as 'useForm'). using react js
- Attempted import error: 'uuid' does not contain a default export (imported as 'uuid') In React
- Gatsby - Warn Attempted import error: 'css' does not contain a default export (imported as 'styles')
- Attempted import error: 'path-to-regexp' does not contain a default export (imported as 'pathToRegexp')
- Attempted import error: does not contain a default export
- Attempted import error: './components' does not contain a default export (imported as 'App')
- Attempted import error: 'firebase/app' does not contain a default export (imported as 'firebase')
- REACT - Error: Attempted import error/ App' does not contain a default export (imported as 'App'
- Attempted import error: './movieReducer' does not contain a default export (imported as 'movieReducer')
- Attempted import error: 'react-table' does not contain a default export (imported as 'ReactTable')
- Attempted import error: 'reactstrap' does not contain a default export (imported as 'Table')
- React JS Attempted import error: './Pathfinder/Pathfinder' does not contain a default export (imported as 'Pathfinder')
- Unable to find solution - showing error in this way - "Attempted import error: 'date-fns' does not contain a default export (imported as 'dateFns')."
- index.js attempted import error: './App' does not contain a default export (imported as 'App')
- Attempted import error: './redux/reducers/configureStore' does not contain a default export (imported as 'configureStore')
- How do I fix a Firebase 9.0 import error? "Attempted import error: 'firebase/app' does not contain a default export (imported as 'firebase')."
- import error: 'unsplash-js' does not contain a default export (imported as 'Unsplash')
- [React.js]Attempted import error: './registerServiceWorker' does not contain a default export (imported as 'registerServiceWorker')
- import error: './App' does not contain a default export (imported as 'App')
- Spine and Reactjs issues error @esotericsoftware/spine-player' does not contain a default export (imported as 'spine')
- Attempted import error: my file does not contain a default export?
- Compile error '@material-ui/core' does not contain an export named 'makeStyles' after Material-ui-pickers installation
- does not contain a default export even after being correctly imported in React
- scss file does not contain a default export (Gatsby and Sass)
- React table does not contain a default export
- Why does typescript infer a default prop when we dynamically import a javascript file which does not have a default export
- VSCode does not suggest auto import when re-exporting a default export in an index file
- error: 'array-move' does not contain a default export (imported as 'move')
- REACT - error: 'slate-react' does not contain a default export (imported as 'Editor')
- Home does not contain an export named Home
More Query from same tag
- Button content blocks ability to click the button
- Unexpected token when mapping in React
- JvectorMap rerendering proper markers after setState reactjs
- How to change more than 1 state in React-easy-state?
- Error in ReduxToolkit can't handle API error
- React Ace editor marker highlight the whole line even startCol and endCol defined to limit the columns
- react-redux 4.0: testing mapStateToProps and mapDispatchToProps?
- ReferenceError: window is not defined, consider using the "jsdom" test environment (jest V28)
- animate component entering the DOM in ReactJS
- Project Structure for a CRA React Project with React Query
- Pulling the next row of data from a dynamic table into a dialog in ReactJS
- How to use history.push from Homepage to other components?
- Using Reselect in mapState to add together selector values
- On filter not getting the data using filter function using javasctipt
- How to update nested objects in React state?
- Flowrouter.path not working
- Make MUI Checkbox border color as gradient
- How can update props in child component functional component?
- Nextjs state reset every socket event occur
- Reactjs - state updating - Ajax - Axios
- combining useState hook in a react component
- Static propTypes not working under ES6
- How do I hide error(s) after a few seconds? MERN stack
- How to properly mock a node module for jest unit testing
- I'm trying to close the offcanvas menu in React Bootstrap when I click a link
- Why do I get an error TS2339: Property 'classList' does not exist on type 'never'?
- React Router v4 :param conflicting with 404
- Cannot read property of data null react
- getDerivedStateFromProps Does not re-render after Redux Reducer state is updated
- undefined is not an object (evaluating '_reactNativeRouterFlux2.default.Router')