여기 내가 잘못하고있는 것을 이해하지 못합니다. 내 앱에 Immutable.js
& React
을 사용하고 있습니다. 나는 Immutable.js의 filter
함수를 호출하여 if
조건 & 반환 구성 요소 배열을 기반으로 컬렉션을 구체화합니다.필터 함수를 사용하여 반응 구성 요소 반환 - 코드 검토
사실은 React 구성 요소 컬렉션 대신 'svgTemplateState'를 반환합니다.
let getUpdatedTem = (renderType, svgTemplateState) => {
switch(renderType){
case("Template Selection"):
return(svgTemplateState.filter((templateType) => {
if(templateType.get("templateNo") > -1){
let temType = templateType.get("type");
return(
<TemplatePath
temData = { templateType }
key = { temType } />
);
}
}));
case("Preview"):
...
일반적으로 술어 –
과 일치하는 모든 요소의 다른 목록을 갖도록 목록을 필터링합니다. 반환되는 목록은 'TemplatePath' 배열을 반환 할 때'svgTemplateState '배열과 같습니다. – Kayote