4
I don’t know how to describe why I couldn’t find information about. kkk
At the end of the code when exporting "connect", what does the second parenthesis do? What is called this syntax?
import React from 'react';
import { connect } from 'react-redux';
const Sidebar = ({ modules }) => (
<aside>
{ modules.map( itModule => (
<div key={itModule.id}>
<strong>{itModule.title}</strong>
<ul>
{itModule.lessons.map( itLesson =>(
<li key={itLesson.id}>
{itLesson.title}
</li>
))}
</ul>
</div>
))}
</aside>
);
export default connect( state => ({ modules: state }))(Sidebar); // <---------<<
You can take a look at the function code to kill curiosity as well. The
connect
exported is that function– Rafael Tavares