Skip to content

Is it possible to use CraftJS with Render Props? #529

Discussion options

You must be logged in to vote

Also, the issue here is not with craft. The component function as a children part is resolved dynamically and you can't serialize that. I did have a similar problem with the tabs component and I had to change how I implement the underlying component. Here is an example of how I did it:

import classNames from 'classnames';
import { forwardRef, useState } from 'react';
import { map } from '../../utils/ElementChildren';

const Tabs = forwardRef((props, ref) => (
  <div ref={ref}>
    <TabsComponent {...props} />
  </div>
));

export default Tabs;

function TabsComponent({ children, tabs }) {
  const [activeTabIndex, setActiveTabIndex] = useState(0);
  return (
    <div className="card">
      <

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@martin-dimi
Comment options

@ismajl-ramadani
Comment options

@ismajl-ramadani
Comment options

@ismajl-ramadani
Comment options

Answer selected by martin-dimi
@martin-dimi
Comment options

@martin-dimi
Comment options

@martin-dimi
Comment options

@ismajl-ramadani
Comment options

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