react-html-email icon indicating copy to clipboard operation
react-html-email copied to clipboard

When to use <Box>?

Open acomito opened this issue 8 years ago • 7 comments

I keep getting this error anytime I use box inside < Email >

<table> cannot appear as a child of <tbody>. See MyReactComponent > Email > Box > tbody > Box > table.

acomito avatar Nov 18 '16 13:11 acomito

@acomito did you figure anything out here? i just ran into the same situation!

brandly avatar Dec 05 '16 20:12 brandly

@acomito I get these but they are warnings. Email is getting delivered fine. Warning: Unknown props bgcolor, border, align, valign on

tag. Remove these props from the element. For details, see https://fb.me/react-unknown-prop W20161207-21:56:02.102(-8)? (STDERR) in table (created by Box) W20161207-21:56:02.102(-8)? (STDERR) in Box (created by Email) W20161207-21:56:02.103(-8)? (STDERR) in body (created by Email) W20161207-21:56:02.104(-8)? (STDERR) in html (created by Email)

codeVana avatar Dec 08 '16 06:12 codeVana

Don't you have to put the <Box> inside an <Item>? The <Item> is like a <tr><td>, from the docs).

poshest avatar Jan 29 '17 19:01 poshest

@acomito @brandly

The reason you are getting this is because the <Email /> component renders a <Box /> element. The box renders a table and then a nested tbody as it's children. By putting a <Box /> inside the <Email /> you are trying to put a table inside a tbody which is invalid html probably. The <Box /> doesn't need to be used here, it's only if you want another table somewhere else.

MartinDawson avatar Jun 14 '17 19:06 MartinDawson

@MartinDawson what do you mean by somewhere else ? Do you mean outside <Email /> ? Would that make sens?

kopax avatar Oct 10 '18 03:10 kopax

Update:

I've just been using es6 strings. You can use variables in it. You can easily break them out into component-ish string fragments (you could even make them functions that consume variables.

You can use mailchimps free email builder, then export the html and plop that into a string and go from there.

acomito avatar Oct 10 '18 15:10 acomito

I agree this is very confusing, the docs are a bit unclear. Basically Email mounts a table and content goes inside tbody so if you try to put a Box inside it'll generate invalid markup. Basically only use Box inside of Item if you want nested tables, otherwise just use Item

rohan-deshpande avatar Jul 29 '19 21:07 rohan-deshpande