2

I have a Semantic UI React Dropdown component with options like

const options = [
  { key: 'user', text: 'Account', icon: 'user' },
  { key: 'settings', text: 'Settings', icon: 'settings' },
  { key: 'sign-out', text: 'Sign Out', icon: 'sign out' },
]

I want to link each of the above items to a url such as '/account', '/settings' and '/logout'

I'm not sure how to trigger such action. I do not see any href or in the props. I'm guessing I will have to write a onClick or onChange function?

1 Answer 1

4

simple task, not use onChange for change route :

import { Link } from 'react-router-dom';

const options = [
  { key: 'user', text: 'Account', icon: 'user', as: Link, to: '/my-account' },
  { key: 'settings', text: 'Settings', icon: 'settings' },
  { key: 'sign-out', text: 'Sign Out', icon: 'sign out' },
]
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.