mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-02 05:03:44 +08:00
Update Writing-Addon doc
(two line change) Update Writing-Addon doc to fix error in reading parameter data. As currently written this causes an exception due to the object returned not being a string. Two ways to fix this, change the data passed by param to just a bare string in the story code above, or change how the addon handles the parameter data. The second is preferable since this is the more likely scenario, and a more useful showcase of passing parameter data. This is the path I've chosen to changed.
This commit is contained in:
parent
5abdfd866d
commit
e85a12842e
@ -74,8 +74,8 @@ const PANEL_ID = `${ADDON_ID}/panel`;
|
||||
|
||||
const MyPanel = () => {
|
||||
const value = useParameter(PARAM_KEY, null);
|
||||
|
||||
return <div>{value}</div>;
|
||||
const item = value ? value.data : "";
|
||||
return <div>{item}</div>;
|
||||
}
|
||||
|
||||
addons.register(ADDON_ID, api => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user