im는 반응을 사용하고 아이를 렌더링하고 조건에 따라 클래스를 추가하기 만하면되는 컴포넌트가 있습니다. 최선의 방법은 무엇입니까? 당신은 아이까지 소품을 전달할 수 있습니다React - 자식 컴포넌트에 클래스 추가하기
var childClasses = [],
childClassNames;
if (condition) {
childClasses.push('my-class-name');
}
childClassNames = childClasses.join(' ');
return (<div className={childClassNames}>
.... (your component here)
</div>);
[이] (http://stackoverflow.com/questions/26863938/modify-attributes-of-children-in-reactjs-component) 당신을 도움이 될 것입니다. –