Skip to content

Nested block editor #35334

Answered by talldan
Lovor01 asked this question in Q&A
Oct 4, 2021 · 4 comments · 3 replies
Discussion options

You must be logged in to vote

Seems like it should work, except I don't understand what is happening with this bit:

const retrievedID = useEntityId( 'postType', 'biographies' );
useEffect(() => setPostID(retrievedID), [retrievedID])

Is it needed? I think your component should know what the id is via the prop rather than setting it itself. This might be where it's going wrong.

useEntityId will also only work within an EntityProvider (you'd need a parent component implementing this so that the hook can access the react context).

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@Lovor01
Comment options

@talldan
Comment options

Answer selected by youknowriad
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Lovor01
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.
2 participants
Converted from issue

This discussion was converted from issue #35316 on October 05, 2021 02:38.