Skip to content

How would you implement this convert this React code? #52

Answered by rgossiaux
sbadisa asked this question in Q&A
Discussion options

You must be logged in to vote

You need the let: active and let: checked on the surrounding <RadioGroupOption> component. Then you can use those variables inside that tag.

For your snippet, you've actually changed too much. That <span> just needs to have className renamed to class and that's it. You've additionally turned class into a function, but it should just be a string like in the original code: this snippet

classNames(
                            checked ? 'bg-sky-600 border-transparent' : 'bg-white border-gray-300',
                            active ? 'ring-2 ring-offset-2 ring-sky-500' : '',
                            'h-4 w-4 mt-0.5 cursor-pointer rounded-full border flex items-center justify-center'

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by sbadisa
Comment options

You must be logged in to vote
4 replies
@sbadisa
Comment options

@rgossiaux
Comment options

@vhscom
Comment options

@sbadisa
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants