Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Hooks #84

Open
florinesueur opened this issue Aug 10, 2019 · 3 comments
Open

React Hooks #84

florinesueur opened this issue Aug 10, 2019 · 3 comments

Comments

@florinesueur
Copy link

Only when I add addon-jsx, I have this problem.
Screenshot_2019-08-10 Storybook

button.tsx

import './button.style.css';
import * as React from 'react';

interface Props {
	/**
	 * Text for the button
	 */
	text: String;
}

export const ButtonNew = ({ text }: Props) => {
	const [value, setValue] = React.useState('...');

	console.log(value);

	return (
		<div>
			<div className="green">
				{text}
				<input type="text" value={value} onChange={({ target }) => setValue(target.value)} />
			</div>
		</div>
	);
};

ButtonNew.defaultProps = {
	text: 'ok',
};

button.stories.tsx

import * as React from 'react';
import { setAddon, storiesOf } from '@storybook/react';
import JSXAddon from 'storybook-addon-jsx';

setAddon(JSXAddon);

import { ButtonNew } from '../src/components/button/button';

storiesOf('Administrator/Button', module).addWithJSX('custom', () => <ButtonNew />);

Did you have the same issue?

@Gabrielmtn
Copy link

Did you find a solution @florinesueur?

@florinesueur
Copy link
Author

@Gabrielmtn no, I did not find a solution and I put this project in standby.

@hipstersmoothie
Copy link
Contributor

Can you try this again? my projects use many hooks and this addon works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants