Konrad Kluzek
Konrad Kluzek

Reputation: 47

Export 2 different HOC

export default Component; //work well
export const one = oneHOC(Component); //not work
export const two = twoHOC(Component); // not work

How to import HOC in different file in curly brackets? Something like:

import {one, two} from "path/to/component"

Upvotes: 2

Views: 35

Answers (1)

Austin Greco
Austin Greco

Reputation: 33544

I think the problem might be capitalization -- sometimes react requires your components to be uppercase. Try this:

export default Component; //work well
export const One = oneHOC(Component); //not work
export const Two = twoHOC(Component); // not work

--

import {One, Two} from "path/to/component"

Upvotes: 3

Related Questions