0
return (
            <div className="container-fluid" style={{ marginTop: '72px' }}>
                {/* {button}
                <div className="Cards">{successCards}</div>
                <Modal show={this.state.calendar} modalClosed={this.closeCalendar}>
                    {showCalendar}
                </Modal> */}
                <CalenderContext.Consumer>
                    {context=>{
                        if(context.result.length){
                            context.result.map((successCard) => {
                                return (
                                    <Card
                                        key={successCard.fileName}
                                        image={successCard.imageUrl}
                                        payerName={successCard.result.payer.payerName}
                                        subscriberName={successCard.result.subscriberName.subscriberName}
                                        subscriberId={successCard.result.subscriberId.subscriberName}
                                    />
                                );
                            });
                        }
                    }}
                </CalenderContext.Consumer>
            </div>
        );

I am getting context properly as an array. everything is fine but nothing is rendered. Can anyone help to resolve the issue.

1 Answer 1

1

Solved the proble by using react Fragment.

<CalenderContext.Consumer>
                    {context=>(
                        <Fragment>
                            {context.result.map((successCard) => {
                                return (
                                    <Card
                                        key={successCard.fileName}
                                        image={successCard.imageUrl}
                                        payerName={successCard.result.payer.payerName}
                                        subscriberName={successCard.result.subscriberName.subscriberName}
                                        subscriberId={successCard.result.subscriberId.subscriberName}
                                    />
                                );
                            })}
                        </Fragment>
                    )}
                </CalenderContext.Consumer>

Thanks.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.