react-component / react-component/menu

Use a ref instead of findDOMNode

Open
#215 5 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
701
Forks
266
Avg merge
4d 11h
Merged PRs (30d)
3

Description

findDOMNode is deprecated and will cause issues in the future. I've just experimented with the new React.lazy() api and I got an exception right here:

https://github.com/react-component/menu/blob/master/src/MenuItem.jsx#L54-L56

When I was asynchronously loading a component into my page. Instead of using findDOMNode we should be using a ref.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/MenuItem.jsx lines 54-56, where findDOMNode is used, and review how the menu item handles asynchronously loaded components with React.lazy(). Replace that usage with a ref while preserving the existing behavior, then verify that the lazy-loaded component no longer triggers the deprecated API exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.