Skip to content

[QUESTION] - Is it possible make dependent components? #726

Closed Answered by chrisvxd
oarkflow asked this question in Q&A
Discussion options

You must be logged in to vote

I see you also asked this in Discord. React context is the correct way to do this, with the Table component setting it up with a provider. Something like this:

const ctx = createContext();

const { Provider } = ctx;

const config = {
  components: {
    Table: {
      render: () => {
        const [query, setQuery] = useState();
        
        return (<Provider value={{ query, setQuery }}>
          <DropZone allow={[ "TableSearch" ]} zone="filters" />
          <table></table>
        </Provider>)
      }
    },
    TableSearch: {
      render: () => {
        const { setQuery } = useContext(ctx);
        
        return <input type="text" onChange=(e => setQuery(e.target.value)) name=…

Replies: 1 comment

Comment options

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