The Flash
component has been deprecated in favour of Toast
component. This codemod converts all Flash
instances to Toast
- import Flash from "carbon-react/lib/components/flash";
+ import Toast from "carbon-react/lib/components/toast";
- <Flash message="hello" />
+ <Toast variant="success" isCenter>hello</Toast>
It's likely that props might be assigned in a different manners, therefore this codemod accounts for several prop patterns.
<Flash prop="something" />
<Flash prop={"something"} />
const value = "something";
<Flash prop={value} />;
const props = { prop: "something" };
<Flash {...props} />;
<Flash {...{ prop: "something" }} />
const prop = "something";
<Flash {...{ prop }} />;
const value = "something";
<Flash {...{ prop: value }} />;
If there is a pattern that you use that is not transformed, please file a feature request.
npx carbon-codemod replace-flash-with-toast <target>
npx carbon-codemod replace-prop-value src